diff options
Diffstat (limited to '')
-rw-r--r-- | common/gettime.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/gettime.c b/common/gettime.c index 52f94b535..42261f96a 100644 --- a/common/gettime.c +++ b/common/gettime.c @@ -27,6 +27,7 @@ #include "util.h" #include "i18n.h" +#include "gettime.h" static unsigned long timewarp; static enum { NORMAL = 0, FROZEN, FUTURE, PAST } timemode; @@ -507,6 +508,23 @@ dump_isotime (const gnupg_isotime_t t) } +/* Copy one ISO date to another, this is inline so that we can do a + minimal sanity check. A null date (empty string) is allowed. */ +void +gnupg_copy_time (gnupg_isotime_t d, const gnupg_isotime_t s) +{ + if (*s) + { + if ((strlen (s) != 15 || s[8] != 'T')) + BUG(); + memcpy (d, s, 15); + d[15] = 0; + } + else + *d = 0; +} + + /* Add SECONDS to ATIME. SECONDS may not be negative and is limited to about the equivalent of 62 years which should be more then enough for our purposes. */ |