Skip to content

Commit

Permalink
Merge branch 'bugfix/mktime_tzset_v4.4' into 'release/v4.4'
Browse files Browse the repository at this point in the history
core-system/newlib: updated docs to reflect that tzset() needs to be called (v4.4)

See merge request espressif/esp-idf!23901
  • Loading branch information
ESP-Marius committed Jun 8, 2023
2 parents 63dfda0 + aab35a2 commit b0729b5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/en/api-reference/system/system_time.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ If you need to obtain time with one second resolution, use the following method:
time(&now);
// Set timezone to China Standard Time
setenv("TZ", "CST-8", 1);
/* According to the posix standard localtime/mktime should use timezone information as though localtime/mktime() calls tzset(),
but this is not the case in older versions of Newlib. We manually call tzset to ensure the timezone info is updated*/
tzset();
localtime_r(&now, &timeinfo);
Expand Down

0 comments on commit b0729b5

Please sign in to comment.