mirror of
https://tinyplantnews.com/git2/ldaphotos
synced 2025-01-10 10:25:15 +00:00
da6f0568b6
Takes a line of input from stdin, then outputs its SHA256 hash. Verbosity cannot be changed.
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;
|
|
}
|