File tree Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Expand file tree Collapse file tree 2 files changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ intptr_t OS::ProcessId() {
102102static bool LocalTime (int64_t seconds_since_epoch, tm* tm_result) {
103103 time_t seconds = static_cast <time_t >(seconds_since_epoch);
104104 if (seconds != seconds_since_epoch) return false ;
105+ // No need to call tzset() before localtime_r() because bionic
106+ // will handle timezone changes for us (starting from Android O).
107+ // See https://android.googlesource.com/platform/bionic/+/ea87716696bf635706b6f3fa56b8a145add83aff
105108 struct tm * error_code = localtime_r (&seconds, tm_result);
106109 return error_code != nullptr ;
107110}
Original file line number Diff line number Diff line change @@ -418,6 +418,7 @@ intptr_t OS::ProcessId() {
418418static bool LocalTime (int64_t seconds_since_epoch, tm* tm_result) {
419419 time_t seconds = static_cast <time_t >(seconds_since_epoch);
420420 if (seconds != seconds_since_epoch) return false ;
421+ tzset (); // Not guaranteed by POSIX to be called by `localtime_r`.
421422 struct tm * error_code = localtime_r (&seconds, tm_result);
422423 return error_code != nullptr ;
423424}
You can’t perform that action at this time.
0 commit comments