#include #include #include #define TIMEBUFLEN 48 static char timebuf[TIMEBUFLEN]; const char * currtime(void) { time_t tttt; time(&tttt); struct tm timeparts; #ifdef USE_LOCALTIME localtime_r(&tttt, &timeparts); #endif #ifndef USE_LOCALTIME gmtime_r(&tttt, &timeparts); #endif sprintf(timebuf, "%02d-%02d-%d %02d:%02d:%02d", timeparts.tm_mday, timeparts.tm_mon + 1, timeparts.tm_year + 1900, timeparts.tm_hour, timeparts.tm_min, timeparts.tm_sec); return (const char *)timebuf; }