From 0a043101cf6c94b391204006f3cd33091fe9e061 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 20 Apr 2010 11:52:33 +0000 Subject: Add a separate header for time related fucntions. --- common/gettime.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'common/gettime.c') 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. */ -- cgit v1.2.3