MCPcopy Create free account
hub / github.com/chen3feng/toft / Format

Method Format

system/time/date.cpp:208–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208std::string Date::Format(const std::string& format) const {
209 struct tm tm = {};
210 tm.tm_year = m_year - 1900;
211 tm.tm_mon = m_month - 1;
212 tm.tm_mday = m_day;
213 char buf[4096];
214 size_t n = strftime(buf, sizeof(buf), format.c_str(), &tm);
215 return std::string(buf, n);
216}
217
218bool Date::Parse(const std::string& src, const std::string& format) {
219 struct tm tm = {};

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64