92 while ((secs = yearSecs(tm.tm_year + 1900)) <= value) {
95 if (tm.tm_year + 1900 > 9999) {
101 while ((secs = monthSecs(tm.tm_mon, tm.tm_year + 1900)) <= value) {
107 while (86400 <= value) {
113 while (3600 <= value) {
119 while (60 <= value) {
127 oss << setfill(
'0') << setw(4) << tm.tm_year + 1900 << setw(2) << tm.tm_mon + 1 << setw(2)
128 << tm.tm_mday << setw(2) << tm.tm_hour << setw(2) << tm.tm_min << setw(2) << tm.tm_sec;
152 for (string::size_type i = 0; i < time_txt.length(); ++i) {
153 if (!isdigit(time_txt.at(i))) {
158 unsigned year, month, day, hour, minute, second;
159 if (time_txt.length() != DATE_LEN || sscanf(time_txt.c_str(),
"%4u%2u%2u%2u%2u%2u", &year,
160 &month, &day, &hour, &minute, &second) != 6) {
164 checkRange(1970, 9999, year,
"year");
165 checkRange(1, 12, month,
"month");
166 checkRange(1, days[month - 1] + ((month == 2 && isLeap(year)) ? 1 : 0), day,
"day");
167 checkRange(0, 23, hour,
"hour");
168 checkRange(0, 59, minute,
"minute");
169 checkRange(0, 60, second,
"second");
171 uint64_t timeval = second + (ull(60) * minute) + (ull(3600) * hour) + ((day - 1) * ull(86400));
172 for (
unsigned m = 0; m < (month - 1); ++m) {
173 timeval += days[m] * ull(86400);
176 if (isLeap(year) && month > 2) {
177 timeval += ull(86400);
180 for (
unsigned y = 1970; y < year; ++y) {
181 timeval += ((isLeap(y) ? 366 : 365) * ull(86400));