diff options
author | B. Stack <bgstack15@gmail.com> | 2021-06-12 16:51:25 +0000 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-06-12 16:51:25 +0000 |
commit | d22ca0d17503de5733c909764cd54b586b52134f (patch) | |
tree | b8076aea9d6e6408500ea8925ff233c2159a220b /zen/time.h | |
parent | Merge branch '11.10' into 'master' (diff) | |
parent | add upstream 11.11 (diff) | |
download | FreeFileSync-d22ca0d17503de5733c909764cd54b586b52134f.tar.gz FreeFileSync-d22ca0d17503de5733c909764cd54b586b52134f.tar.bz2 FreeFileSync-d22ca0d17503de5733c909764cd54b586b52134f.zip |
Merge branch '11.11' into 'master'11.11
add upstream 11.11
See merge request opensource-tracking/FreeFileSync!34
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: |