| 56 | } |
| 57 | |
| 58 | static tm time_localtime_threadlocal(time_t *time_data) |
| 59 | { |
| 60 | #if defined(CONF_FAMILY_WINDOWS) |
| 61 | // The result of localtime is thread-local on Windows |
| 62 | // https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/localtime-localtime32-localtime64 |
| 63 | tm *time = localtime(time_data); |
| 64 | #else |
| 65 | // Thread-local buffer for the result of localtime_r |
| 66 | thread_local tm time_info_buf; |
| 67 | tm *time = localtime_r(time_data, &time_info_buf); |
| 68 | #endif |
| 69 | dbg_assert(time != nullptr, "Failed to get local time for time data %" PRId64, (int64_t)time_data); |
| 70 | return *time; |
| 71 | } |
| 72 | |
| 73 | int time_houroftheday() |
| 74 | { |
no outgoing calls
no test coverage detected