aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2005-03-14 20:41:20 +0000
committerWerner Koch <[email protected]>2005-03-14 20:41:20 +0000
commita177090f378cef71f363ef0e56c3913763cc6d5f (patch)
tree17034b7dfe2021e728fe8e5491648058cf41ecdc /util/miscutil.c
parent* cardglue.c (pin_cb): Disable debug output. (diff)
downloadgnupg-a177090f378cef71f363ef0e56c3913763cc6d5f.tar.gz
gnupg-a177090f378cef71f363ef0e56c3913763cc6d5f.zip
* card-util.c (card_status): Use isotimestamp and not the
localized asctimestamp to match the timezone used in the key information. * miscutil.c (isotimestamp): New.
Diffstat (limited to '')
-rw-r--r--util/miscutil.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index 4c2c0edfc..aa3973b92 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -1,6 +1,6 @@
/* miscutil.c - miscellaneous utilities
* Copyright (C) 1998, 1999, 2000, 2001, 2003,
- * 2004 Free Software Foundation, Inc.
+ * 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -137,6 +137,29 @@ strtimestamp( u32 stamp )
return buffer;
}
+
+/****************
+ * Note: this function returns GMT
+ */
+const char *
+isotimestamp (u32 stamp)
+{
+ static char buffer[25+5];
+ struct tm *tp;
+ time_t atime = stamp;
+
+ if (atime < 0) {
+ strcpy (buffer, "????" "-??" "-??" " " "??" ":" "??" ":" "??");
+ }
+ else {
+ tp = gmtime( &atime );
+ sprintf(buffer,"%04d-%02d-%02d %02d:%02d:%02d",
+ 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
+ tp->tm_hour, tp->tm_min, tp->tm_sec);
+ }
+ return buffer;
+}
+
/****************
* Note: this function returns local time
*/