aboutsummaryrefslogtreecommitdiffstats
path: root/common/util.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--common/util.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/common/util.h b/common/util.h
index 78aa2f890..fb2c6e839 100644
--- a/common/util.h
+++ b/common/util.h
@@ -51,6 +51,12 @@
#define xrealloc(a,b) gcry_xrealloc ((a),(b))
#define xstrdup(a) gcry_xstrdup ((a))
+
+/* A type to hold the ISO time. Note that this this is the same as
+ the the KSBA type ksba_isotime_t. */
+typedef char gnupg_isotime_t[16];
+
+
/*-- maperror.c --*/
int map_ksba_err (int err);
int map_gcry_err (int err);
@@ -60,6 +66,7 @@ int map_to_assuan_status (int rc);
/*-- gettime.c --*/
time_t gnupg_get_time (void);
+void gnupg_get_isotime (gnupg_isotime_t timebuf);
void gnupg_set_time (time_t newtime, int freeze);
int gnupg_faked_time_p (void);
u32 make_timestamp (void);
@@ -69,6 +76,18 @@ const char *strtimevalue (u32 stamp);
const char *strtimestamp (u32 stamp); /* GMT */
const char *asctimestamp (u32 stamp); /* localized */
+
+/* Copy one iso ddate to another, this is inline so that we can do a
+ sanity check. */
+static inline void
+gnupg_copy_time (gnupg_isotime_t d, const gnupg_isotime_t s)
+{
+ if (*s && (strlen (s) != 15 || s[8] != 'T'))
+ BUG();
+ strcpy (d, s);
+}
+
+
/*-- signal.c --*/
void gnupg_init_signals (int mode, void (*fast_cleanup)(void));
void gnupg_pause_on_sigusr (int which);