1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2025-11-22 05:40:35 +00:00

variant time_t type work

SCCS-file: difftime.c
SCCS-SID: 7.11
This commit is contained in:
Arthur David Olson
2004-10-21 10:32:51 -04:00
committed by Paul Eggert
parent baf93985c0
commit c32d0771ec

View File

@ -22,28 +22,17 @@ const time_t time0;
if (!TYPE_INTEGRAL(time_t)) {
/*
** time_t is floating.
** We can't apply % to floats.
** Do the math in whichever of time_t or double is wider.
*/
if (sizeof (time_t) >= sizeof (double))
return time1 - time0;
else return (double) time1 - (double) time0;
} else if (!TYPE_SIGNED(time_t)) {
/*
** time_t is integral and unsigned.
** The difference of two time_t's won't overflow if
** the minuend is greater than or equal to the subtrahend.
*/
if (time1 >= time0)
return time1 - time0;
else return -((double) (time0 - time1));
} else {
/*
** time_t is integral and signed.
** time_t is integral.
** As elsewhere in the time zone package,
** use modular arithmetic to avoid overflow.
** We could check to see if double is sufficiently wider
** than time_t to let us simply return
** (double) time1 - (double) time0
*/
register time_t lead;
register time_t trail;