MCPcopy Create free account
hub / github.com/EmbeddedRPC/erpc / PortableLocaltime

Function PortableLocaltime

test/common/gtest/gtest.cpp:4996–5010  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4994}
4995
4996static bool PortableLocaltime(time_t seconds, struct tm* out) {
4997#if defined(_MSC_VER)
4998 return localtime_s(out, &seconds) == 0;
4999#elif defined(__MINGW32__) || defined(__MINGW64__) || GTEST_OS_BARE_METAL
5000 // MINGW <time.h> provides neither localtime_r nor localtime_s, but uses
5001 // Windows' localtime(), which has a thread-local tm buffer.
5002 struct tm* tm_ptr = localtime(&seconds); // NOLINT
5003 if (tm_ptr == NULL)
5004 return false;
5005 *out = *tm_ptr;
5006 return true;
5007#else
5008 return localtime_r(&seconds, out) != NULL;
5009#endif
5010}
5011
5012// Converts the given epoch time in milliseconds to a date string in the ISO
5013// 8601 format, without the timezone information.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected