aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
Diffstat (limited to 'util')
-rw-r--r--util/ChangeLog4
-rw-r--r--util/miscutil.c25
2 files changed, 28 insertions, 1 deletions
diff --git a/util/ChangeLog b/util/ChangeLog
index 04fe9b26b..4248b2508 100644
--- a/util/ChangeLog
+++ b/util/ChangeLog
@@ -1,3 +1,7 @@
+2005-03-14 Werner Koch <[email protected]>
+
+ * miscutil.c (isotimestamp): New.
+
2005-03-10 Werner Koch <[email protected]>
* secmem.c (secmem_realloc): Take control information into account
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
*/