mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2026-05-09 05:35:44 +00:00
modular arithmetic
SCCS-file: date.c SCCS-SID: 7.40
This commit is contained in:
committed by
Paul Eggert
parent
f20f271478
commit
dca47d48c1
13
date.c
13
date.c
@@ -118,7 +118,7 @@ char * argv[];
|
||||
INITIALIZE(t);
|
||||
#ifdef LC_ALL
|
||||
(void) setlocale(LC_ALL, "");
|
||||
#endif /* defined LC_ALL */
|
||||
#endif /* defined(LC_ALL) */
|
||||
#if HAVE_GETTEXT
|
||||
#ifdef TZ_DOMAINDIR
|
||||
(void) bindtextdomain(TZ_DOMAIN, TZ_DOMAINDIR);
|
||||
@@ -631,8 +631,15 @@ const time_t t;
|
||||
time_t outt;
|
||||
|
||||
tm = *localtime(&t);
|
||||
cent = (tm.tm_year + TM_YEAR_BASE) / 100;
|
||||
year_in_cent = (tm.tm_year + TM_YEAR_BASE) - cent * 100;
|
||||
#define DIVISOR 100
|
||||
year_in_cent = tm.tm_year % DIVISOR + TM_YEAR_BASE % DIVISOR;
|
||||
cent = tm.tm_year / DIVISOR + TM_YEAR_BASE / DIVISOR +
|
||||
year_in_cent / DIVISOR;
|
||||
year_in_cent %= DIVISOR;
|
||||
if (year_in_cent < 0) {
|
||||
year_in_cent += DIVISOR;
|
||||
--cent;
|
||||
}
|
||||
month = tm.tm_mon + 1;
|
||||
day = tm.tm_mday;
|
||||
hour = tm.tm_hour;
|
||||
|
||||
Reference in New Issue
Block a user