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

Function timestamp_from_str

src/base/time.cpp:180–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180bool timestamp_from_str(const char *string, const char *format, time_t *timestamp)
181{
182 std::tm tm{};
183 std::istringstream ss(string);
184 ss >> std::get_time(&tm, format);
185 if(ss.fail() || !ss.eof())
186 return false;
187
188 time_t result = mktime(&tm);
189 if(result < 0)
190 return false;
191
192 *timestamp = result;
193 return true;
194}
195#ifdef __GNUC__
196#pragma GCC diagnostic pop
197#endif

Callers 2

ExtractTimestampMethod · 0.85
TEST_FFunction · 0.85

Calls

no outgoing calls

Tested by 1

TEST_FFunction · 0.68