"Inverted" time_t value handling.

So far time_t values were interpreted as local time values. However, usually time_t values are to be interpreted as "seconds since 1 Jan 1970 in UTC". Therefore all logic handling time_t values has to be changed.

- So far gmtime() called localtime() with an adjusted time_t, now localtime() calls gmtime() with an adjusted time_t.
- mktime() has to do "the opposite" of localtime(), to keep it that way mktime() does now the inverse adjustment made by localtime().
- All currently present time() implementations internally call mktime() so they don't require individual adjustments.
This commit is contained in:
Oliver Schmidt
2018-08-02 17:12:12 +02:00
parent 753b48647f
commit a9ce4dc76c
3 changed files with 27 additions and 31 deletions

View File

@@ -180,7 +180,8 @@ time_t __fastcall__ mktime (register struct tm* TM)
return DayCount * 86400UL +
((unsigned) TM->tm_hour) * 3600UL +
((unsigned) TM->tm_min) * 60U +
((unsigned) TM->tm_sec);
((unsigned) TM->tm_sec) -
_tz.timezone;
Error:
/* Error exit */