diff options
author | Werner Koch <wk@gnupg.org> | 2003-10-31 13:11:57 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2003-10-31 13:11:57 +0100 |
commit | f21638c9e3b614bc0be6903b1fb75543f9619a7b (patch) | |
tree | a5420a9b4af866391297f917721640dbd89f7380 /common/util.h | |
parent | * command.c (cmd_get_confirmation): New command. (diff) | |
download | gnupg2-f21638c9e3b614bc0be6903b1fb75543f9619a7b.tar.xz gnupg2-f21638c9e3b614bc0be6903b1fb75543f9619a7b.zip |
* util.h (gnupg_isotime_t): New.
(gnupg_copy_time): New.
* gettime.c (gnupg_get_isotime): New.
Diffstat (limited to 'common/util.h')
-rw-r--r-- | common/util.h | 19 |
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); |