You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
346 B
19 lines
346 B
/* See LICENSE file for copyright and license details. */
|
|
#include <stdio.h>
|
|
#include <time.h>
|
|
|
|
#include "../util.h"
|
|
|
|
const char *
|
|
datetime(const char *fmt)
|
|
{
|
|
time_t t;
|
|
|
|
t = time(NULL);
|
|
if (!strftime(buf, sizeof(buf), fmt, localtime(&t))) {
|
|
fprintf(stderr, "strftime: Result string exceeds buffer size\n");
|
|
return NULL;
|
|
}
|
|
|
|
return buf;
|
|
}
|
|
|