MCPcopy Create free account
hub / github.com/comaps/comaps / TimestampToString

Function TimestampToString

libs/base/timer.cpp:83–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83std::string TimestampToString(time_t time)
84{
85 if (time == INVALID_TIME_STAMP)
86 return std::string("INVALID_TIME_STAMP");
87
88 tm * t = gmtime(&time);
89 char buf[100];
90#ifdef OMIM_OS_WINDOWS
91 sprintf_s(buf, ARRAY_SIZE(buf), "%04d-%02d-%02dT%02d:%02d:%02dZ", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
92 t->tm_hour, t->tm_min, t->tm_sec);
93#else
94 ::snprintf(buf, ARRAY_SIZE(buf), "%04d-%02d-%02dT%02d:%02d:%02dZ", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
95 t->tm_hour, t->tm_min, t->tm_sec);
96#endif
97
98 return buf;
99}
100
101std::string SecondsSinceEpochToString(uint64_t secondsSinceEpoch)
102{

Callers 2

UNIT_TESTFunction · 0.50

Calls

no outgoing calls

Tested by 1

UNIT_TESTFunction · 0.40