From 6434dc146a218aa1b2c83376d7046e503c9ba9f1 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Wed, 21 Apr 2010 17:22:55 -0400 Subject: [PATCH] terseCurrentTime --- util/goodies.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/goodies.h b/util/goodies.h index 2d9df3b5d13..8cc656ac9b7 100644 --- a/util/goodies.h +++ b/util/goodies.h @@ -165,6 +165,18 @@ namespace mongo { #endif } + inline string terseCurrentTime(){ + struct tm t; + time_t_to_Struct( time(0) , &t ); + stringstream ss; + ss << ( 1900 + t.tm_year ) << "-" + << t.tm_mon << "-" + << t.tm_mday << "-" + << t.tm_hour << "-" + << t.tm_min; + return ss.str(); + } + #define asctime _asctime_not_threadsafe_ #define gmtime _gmtime_not_threadsafe_ #define localtime _localtime_not_threadsafe_