Skip to content

Commit

Permalink
Merge pull request #368 from kingster/feature-localtime
Browse files Browse the repository at this point in the history
Support for `CROW_USE_LOCALTIMEZONE` for using localtime in logs
  • Loading branch information
The-EDev committed Mar 20, 2022
2 parents b135ec6 + 77e68e4 commit 7f2da9b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/crow/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7f2da9b

Please sign in to comment.