After upgrading to Espressif 6.0.1 (esp-idf 5.0), the program crashes on localtime_r()!

After upgrading to esp-idf version 5.0.0, the localtime_r function periodically began to panic with a controller reboot. Not constantly, and randomly - every 2-3 minutes or every few hours.
On version 4.4.3 and below, the same code worked absolutely stably.

C:\PlatformIO\security_v4225\ota>c:\Users\kotyara12\.platformio\packages\toolchain-xtensa-esp32\bin\xtensa-esp32-elf-addr2line.exe -pfiaC -e c:\PlatformIO\security_v4225\ota\firmware\firmware.elf 0x400d4590 0x400ecdae 0x40082829 0x40083512 0x400824ca 0x40089985 0x4008f535 0x4008a40e 0x40083db2 0x40083e65 0x40083eea 0x4016631d 0x4015de08 0x40154d94 0x400d8081 0x400d80bd 0x400d8165 0x400d81b6 0x400d8242 0x400d8291 0x400d8e55 0x400d8bbd 0x400e054a
0x400d4590: __wrap_esp_panic_handler at C:/PlatformIO/libs/system/reEsp32/src/reEsp32.cpp:483
0x400ecdae: panic_handler at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\esp_system\port/panic_handler.c:192
0x40082829: xt_unhandled_exception at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\esp_system\port/panic_handler.c:223
0x40083512: _xt_user_exc at xtensa_vectors.o:?
0x400824ca: panic_abort at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\esp_system/panic.c:412
0x40089985: esp_system_abort at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\esp_system/esp_system.c:135
0x4008f535: __assert_func at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\newlib/assert.c:78
0x4008a40e: xQueueGenericSend at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\freertos\FreeRTOS-Kernel/queue.c:828 (discriminator 2)
0x40083db2: lock_release_generic at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\newlib/locks.c:192
0x40083e65: _lock_release at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\newlib/locks.c:198
0x40083eea: __retarget_lock_release at C:\Users\razzhivinav\.platformio\packages\framework-espidf\components\newlib/locks.c:334
0x4016631d: __tz_unlock at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/time/tzlock.c:50
0x4015de08: localtime_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/time/lcltime_r.c:123
0x40154d94: malloc_timestr_empty at C:/PlatformIO/libs/system/rStrings/src/rStrings.cpp:148
0x400d8081: rSensorItem::asStringTimeValue(sensor_value_t*) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:550
0x400d80bd: rSensorItem::jsonStringTimeValue(sensor_value_t*) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:582
0x400d8165: rSensorItem::jsonPartSensorValue(char const*, sensor_value_t*) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:701
0x400d81b6: rSensorItem::jsonExtremums(char const*, sensor_extremums_t*) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:747
0x400d8242: rSensorItem::jsonValues() at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:848
0x400d8291: rSensorItem::jsonNamedValues() at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:864
0x400d8e55: rSensorX2::getJSON() at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:2155 (discriminator 1)
0x400d8bbd: rSensor::publishData(bool) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:1585
 (inlined by) rSensor::publishData(bool) at C:/PlatformIO/libs/sensors/reSensor/src/reSensor.cpp:1560
0x400e054a: sensorsTaskExec(void*) at C:\PlatformIO\security_v4225/lib/sensors/sensors.cpp:528

Wrote a request for ESP-IDF. Silent!
How to roll back this fu**ing version?

platform =  espressif32@5.3.0

is using ESP-IDF 4.4.3, the last version before ESP-IDF 5.0.

Understood. Thank you!