mirror of
https://tinyplantnews.com/git2/ldaphotos
synced 2025-01-10 18:35:15 +00:00
27 lines
531 B
C
27 lines
531 B
C
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <time.h>
|
||
|
|
||
|
|
||
|
#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;
|
||
|
}
|