summaryrefslogtreecommitdiffstats
path: root/common/gettime.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2010-04-20 13:52:33 +0200
committerWerner Koch <wk@gnupg.org>2010-04-20 13:52:33 +0200
commit0a043101cf6c94b391204006f3cd33091fe9e061 (patch)
treeb84ea408ba48e70d9be29f723a197190e58cc36b /common/gettime.c
parentcommon/ (diff)
downloadgnupg2-0a043101cf6c94b391204006f3cd33091fe9e061.tar.xz
gnupg2-0a043101cf6c94b391204006f3cd33091fe9e061.zip
Add a separate header for time related fucntions.
Diffstat (limited to 'common/gettime.c')
-rw-r--r--common/gettime.c18
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. */