aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>1998-09-15 19:56:30 +0000
committerWerner Koch <[email protected]>1998-09-15 19:56:30 +0000
commit8c80bcf9f02f88c1c29bcf2501e386e0de109993 (patch)
tree8c53a52769093f67423f396bb1fa653bc0635599 /util/miscutil.c
parentversion 0.3.5 (diff)
downloadgnupg-8c80bcf9f02f88c1c29bcf2501e386e0de109993.tar.gz
gnupg-8c80bcf9f02f88c1c29bcf2501e386e0de109993.zip
.
Diffstat (limited to '')
-rw-r--r--util/miscutil.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/util/miscutil.c b/util/miscutil.c
index 041c6faa5..00293089d 100644
--- a/util/miscutil.c
+++ b/util/miscutil.c
@@ -39,6 +39,9 @@ add_days_to_timestamp( u32 stamp, u16 days )
return stamp + days*86400L;
}
+/****************
+ * Note: this function returns GMT
+ */
const char *
strtimestamp( u32 stamp )
{
@@ -53,6 +56,26 @@ strtimestamp( u32 stamp )
}
/****************
+ * Note: this function returns local time
+ */
+const char *
+asctimestamp( u32 stamp )
+{
+ static char buffer[30];
+ struct tm *tp;
+ time_t atime = stamp;
+
+ tp = localtime( &atime );
+ #ifdef HAVE_STRFTIME
+ mem2str( buffer, asctime(tp), DIM(buffer) );
+ #else
+ strftime( buffer, DIM(buffer)-1, "%c", tp );
+ buffer[DIM(buffer)-1] = 0;
+ #endif
+ return buffer;
+}
+
+/****************
* Print a string to FP, but filter all control characters out.
*/
void