From cca66b9ec4e494c1d919bff0f71a820d8afab1fa Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:24:48 +0200 Subject: Adding upstream version 1.2.2. Signed-off-by: Daniel Baumann --- src/3rdparty/autotrace/datetime.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/3rdparty/autotrace/datetime.c (limited to 'src/3rdparty/autotrace/datetime.c') diff --git a/src/3rdparty/autotrace/datetime.c b/src/3rdparty/autotrace/datetime.c new file mode 100644 index 0000000..ff3e779 --- /dev/null +++ b/src/3rdparty/autotrace/datetime.c @@ -0,0 +1,20 @@ +#include +#include +#include + +char *at_time_string(void) +{ + char *time_string = calloc(sizeof(char), 25); + time_t t = time(NULL); +#if HAVE_LOCALTIME_R + struct tm newtime; + + localtime_r(&t, &newtime); + strftime(time_string, 25, "%c", &newtime); +#else + // the mingw-w64 toolchain does not have localtime_r() + strftime(time_string, 25, "%c", localtime(&t)); +#endif + + return time_string; +} -- cgit v1.2.3