diff options
author | B. Stack <bgstack15@gmail.com> | 2021-06-12 09:59:08 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-06-12 09:59:23 -0400 |
commit | fc71e66e5186fb75206290deca2b9a6cfbefa9ac (patch) | |
tree | b8076aea9d6e6408500ea8925ff233c2159a220b /zen/time.h | |
parent | Merge branch '11.10' into 'master' (diff) | |
download | FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.tar.gz FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.tar.bz2 FreeFileSync-fc71e66e5186fb75206290deca2b9a6cfbefa9ac.zip |
add upstream 11.11
Diffstat (limited to 'zen/time.h')
-rw-r--r-- | zen/time.h | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -159,11 +159,23 @@ TimeComp getUtcTime2(time_t utc) { //1. convert: seconds since year 1: //... + //assert(time_t is signed) //TODO: what if < 0? long long remDays = utc / (24 * 3600); long long remSecs = utc % (24 * 3600); + //days per year + const int dpYearStd = 365; + const int dpYearLeap = dpYearStd + 1; + const int dp4Years = 3 * dpYearStd + dpYearLeap; + const int dp100YearsStd = 25 * dp4Years - 1; //no leap days for centuries... + const int dp100YearsExc = 25 * dp4Years; //...except if divisible by 400 + const int dp400Years = 3 * dp100YearsStd + dp100YearsExc; + + + + const int daysPer4Years = 4 * 365 /*usual days per year*/ + 1 /*including leap day*/; const int daysPerYear = 365; //non-leap const int daysPer100Years = 25 * daysPer4Years - 1; @@ -197,6 +209,8 @@ TimeComp getUtcTime2(time_t utc) + const char daysPerMonth[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; + //first four years of century: |