Skip to content

Commit ce432db

Browse files
committed
Support for CROW_USE_LOCALTIMEZONE
define CROW_USE_LOCALTIMEZONE macro for explict optin for localtimezone in logs
1 parent bdbed55 commit ce432db

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

include/crow/logging.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,17 @@ namespace crow
7272
tm my_tm;
7373

7474
#if defined(_MSC_VER) || defined(__MINGW32__)
75+
#ifdef CROW_USE_LOCALTIMEZONE
76+
localtime_s(&my_tm, &t);
77+
#else
7578
gmtime_s(&my_tm, &t);
79+
#endif
80+
#else
81+
#ifdef CROW_USE_LOCALTIMEZONE
82+
localtime_r(&t, &my_tm);
7683
#else
7784
gmtime_r(&t, &my_tm);
85+
#endif
7886
#endif
7987

8088
size_t sz = strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", &my_tm);

0 commit comments

Comments
 (0)