MCPcopy Create free account
hub / github.com/catboost/catboost / YearToString

Function YearToString

util/datetime/base.cpp:287–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287TString YearToString(const struct tm& theTm) {
288 Y_ENSURE(0 <= theTm.tm_year + 1900 && theTm.tm_year + 1900 <= 9999, "invalid year " + ToString(theTm.tm_year + 1900) + ", year should be in range [0, 9999]");
289 char buf[16];
290 snprintf(buf, 16, "%04d", theTm.tm_year + 1900);
291 return buf;
292}
293
294TString YearToString(time_t when) {
295 struct tm theTm;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 3

localtime_rFunction · 0.85
ToStringFunction · 0.50
snprintfFunction · 0.50

Tested by

no test coverage detected