MCPcopy Create free account
hub / github.com/ddnet/ddnet / time_localtime_threadlocal

Function time_localtime_threadlocal

src/base/time.cpp:58–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58static 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
73int time_houroftheday()
74{

Callers 4

time_hourofthedayFunction · 0.85
time_iseasterdayFunction · 0.85
time_seasonFunction · 0.85
str_timestamp_exFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected