diff options
Diffstat (limited to '')
-rw-r--r-- | util/ChangeLog | 4 | ||||
-rw-r--r-- | util/miscutil.c | 23 |
2 files changed, 27 insertions, 0 deletions
diff --git a/util/ChangeLog b/util/ChangeLog index edcbb5ca3..d282d9a3e 100644 --- a/util/ChangeLog +++ b/util/ChangeLog @@ -1,3 +1,7 @@ +Tue Sep 15 17:52:21 1998 Werner Koch (wk@(none)) + + * miscutil.c (asctimestamp): New. + Mon Sep 14 09:38:18 1998 Werner Koch (wk@(none)) * secmem.c (init_pool): Now mmaps /dev/zero if we do not have MAP_ANON. 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 |