aboutsummaryrefslogtreecommitdiffstats
path: root/util/miscutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/miscutil.c')
-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