Merge pull request #368 from kingster/feature-localtime

Support for `CROW_USE_LOCALTIMEZONE` for using localtime in logs
This commit is contained in:
Farook Al-Sammarraie 2022-03-20 22:11:47 +03:00 committed by GitHub
commit 7f2da9b1c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,9 +72,17 @@ namespace crow
tm my_tm;
#if defined(_MSC_VER) || defined(__MINGW32__)
#ifdef CROW_USE_LOCALTIMEZONE
localtime_s(&my_tm, &t);
#else
gmtime_s(&my_tm, &t);
#endif
#else
#ifdef CROW_USE_LOCALTIMEZONE
localtime_r(&t, &my_tm);
#else
gmtime_r(&t, &my_tm);
#endif
#endif
size_t sz = strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", &my_tm);