summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-03-16 10:44:44 +0100
committerWerner Koch <wk@gnupg.org>2009-03-16 10:44:44 +0100
commit94be7a43417f0a9b48b2e220a308e65d71b8c342 (patch)
tree57bd8ef5cb8a6ff5b103b7e27f20068275d6d561 /common
parent* gpg.c (my_strusage): gpg2 and gpgv2 (not gpg and gpgv). (diff)
downloadgnupg2-94be7a43417f0a9b48b2e220a308e65d71b8c342.tar.xz
gnupg2-94be7a43417f0a9b48b2e220a308e65d71b8c342.zip
Remove duplicated code.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog5
-rw-r--r--common/gettime.c11
-rw-r--r--common/util.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index cbe0a5a28..986041f59 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -3,6 +3,11 @@
* http.c (do_parse_uri): Properly handle IPv6 literal addresses as
per RFC-2732. Adapted from patch by Phil Pennock.
+2009-03-12 Werner Koch <wk@g10code.com>
+
+ * gettime.c: Include i18n.h.
+ (dump_isotime): New.
+
2009-03-06 Werner Koch <wk@g10code.com>
* sexputil.c (make_canon_sexp): New.
diff --git a/common/gettime.c b/common/gettime.c
index c4a9d4844..1b4e435a1 100644
--- a/common/gettime.c
+++ b/common/gettime.c
@@ -26,6 +26,7 @@
#endif
#include "util.h"
+#include "i18n.h"
static unsigned long timewarp;
static enum { NORMAL = 0, FROZEN, FUTURE, PAST } timemode;
@@ -495,6 +496,16 @@ check_isotime (const gnupg_isotime_t atime)
}
+void
+dump_isotime (const gnupg_isotime_t t)
+{
+ if (!t || !*t)
+ log_printf (_("[none]"));
+ else
+ log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
+ t, t+4, t+6, t+9, t+11, t+13);
+}
+
/* Add SECONDS to ATIME. SECONDS may not be negative and is limited
to about the equivalent of 62 years which should be more then
diff --git a/common/util.h b/common/util.h
index d117f86bf..3c664cec7 100644
--- a/common/util.h
+++ b/common/util.h
@@ -119,6 +119,7 @@ const char *asctimestamp (u32 stamp); /* localized */
gpg_error_t add_seconds_to_isotime (gnupg_isotime_t atime, int nseconds);
gpg_error_t add_days_to_isotime (gnupg_isotime_t atime, int ndays);
gpg_error_t check_isotime (const gnupg_isotime_t atime);
+void dump_isotime (const gnupg_isotime_t atime);
/* 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. */