aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2017-12-11 15:33:37 +0000
committerWerner Koch <[email protected]>2017-12-11 15:33:37 +0000
commitf9a33a7f7e44a644ff4e31f7e9f1c2c1ec1f8eee (patch)
tree936ed1f7e629d6b994a18fb5e3984ca1d554a866
parentcore: Rename the gpgrt_log_levels enum values. (diff)
downloadlibgpg-error-f9a33a7f7e44a644ff4e31f7e9f1c2c1ec1f8eee.tar.gz
libgpg-error-f9a33a7f7e44a644ff4e31f7e9f1c2c1ec1f8eee.zip
core: Avoid using estream_t in the public API.
* src/gpg-error.h.in: Always use gpgrt_stream-t. -- estream_t can only be used if GPGRT_ENABLE_ES_MACROS is defined. Fixes-commit: 1865c0ba1769b407a3c504f1ab0a4278704a9fc1 Signed-off-by: Werner Koch <[email protected]>
-rw-r--r--src/gpg-error.h.in37
1 files changed, 33 insertions, 4 deletions
diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 86c6a8a..46e8f53 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -1035,7 +1035,7 @@ void _gpgrt_log_assert (const char *expr, const char *file, int line,
#define GPGRT_SPAWN_DETACHED 128 /* Start the process in the background. */
/* Function and convenience macros to create pipes. */
-gpg_err_code_t gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
+gpg_err_code_t gpgrt_make_pipe (int filedes[2], gpgrt_stream_t *r_fp,
int direction, int nonblock);
#define gpgrt_create_pipe(a) gpgrt_make_pipe ((a),NULL, 0, 0);
#define gpgrt_create_inbound_pipe(a,b,c) gpgrt_make_pipe ((a), (b), -1,(c));
@@ -1046,9 +1046,9 @@ gpg_err_code_t gpgrt_make_pipe (int filedes[2], estream_t *r_fp,
gpg_err_code_t gpgrt_spawn_process (const char *pgmname, const char *argv[],
int *execpt, void (*preexec)(void),
unsigned int flags,
- estream_t *r_infp,
- estream_t *r_outfp,
- estream_t *r_errfp,
+ gpgrt_stream_t *r_infp,
+ gpgrt_stream_t *r_outfp,
+ gpgrt_stream_t *r_errfp,
pid_t *pid);
/* Fork and exec PGNNAME and connect the process to the given FDs. */
@@ -1075,6 +1075,35 @@ void gpgrt_kill_process (pid_t pid);
/* Release process resources identified by PID. */
void gpgrt_release_process (pid_t pid);
+/*
+ * Time functions
+ */
+
+/* Our representation of time requires 8 byte. The value guaranteed
+ * to be a C string with no '\n' in it. The time is always UTC. */
+typedef unsigned char gpgrt_time_t[8];
+
+/* Check that ATIME is a valid time. */
+gpg_err_code_t gpgrt_check_time (const gpgrt_time_t atime);
+
+/* Convert time into a Julian Date. Returns 0 for invalid dates. */
+unsigned int gpgrt_time2jd (const gpgrt_time_t atime, int *r_seconds);
+
+/* Convert the Julian Date (JD,SECS) into a time. If SECS is -1 noon
+ * is assumed. */
+void gpgrt_jd2time (gpgrt_time_t atime, unsigned int jd, int secs);
+
+/* Convert a time into a Julian Date and return it as a float with
+ * fractional seconds. */
+static GPG_ERR_INLINE double
+gpgrt_time2jd_dbl (const gpgrt_time_t atime)
+{
+ unsigned int jd;
+ int secs;
+ jd = gpgrt_time2jd (atime, &secs);
+ return jd + (secs/86400.0);
+}
+
#ifdef __cplusplus