ldaphotos/sources/log.c
Sandy Mossgrave da6f0568b6 Initial commit. Works.
Takes a line of input from stdin, then outputs its SHA256 hash.
Verbosity cannot be changed.
2023-05-21 21:02:25 +00:00

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;
}