diff options
author | ivanselin <[email protected]> | 2022-02-10 16:48:40 +0300 |
---|---|---|
committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:48:40 +0300 |
commit | 496663edd3beee611468aedd4bb9ac100c1a118d (patch) | |
tree | 16cd4c986b35d4fdbdfcaec2b23992e04009283b /util/datetime/systime.cpp | |
parent | cd441de9b6bd02d76655d170f85e57a8941b4bb5 (diff) |
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'util/datetime/systime.cpp')
-rw-r--r-- | util/datetime/systime.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/util/datetime/systime.cpp b/util/datetime/systime.cpp index 6ee7e8fc6ed..6bd9442ffff 100644 --- a/util/datetime/systime.cpp +++ b/util/datetime/systime.cpp @@ -66,15 +66,15 @@ time_t TimeGM(const struct tm* t) { {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}, {0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335}}; - // Only handles years after 1970 + // Only handles years after 1970 if (t->tm_year < 70) { return (time_t)-1; } int days = 365 * (t->tm_year - 70); - // Take into account the leap days between 1970 and YEAR-1 - days += (t->tm_year - 1 - 68) / 4 - ((t->tm_year - 1) / 100) + ((t->tm_year - 1 + 300) / 400); - + // Take into account the leap days between 1970 and YEAR-1 + days += (t->tm_year - 1 - 68) / 4 - ((t->tm_year - 1) / 100) + ((t->tm_year - 1 + 300) / 400); + if (t->tm_mon < 0 || t->tm_mon >= 12) { return (time_t)-1; } |