[tz] source code question regarding localtime.c PS
Paul Goyette
pgoyette at juniper.net
Wed Aug 7 13:38:04 UTC 2013
Since icycles and tcycles are of different types, there could
be some conversion involved at line 1295, with possible data
truncation. Thus, the comparisons on line 1296 might not be
always false.
(I think there were some recent comments about the possibility
of time_t being a non-integral type...)
-----Original Message-----
From: tz-bounces at iana.org [mailto:tz-bounces at iana.org] On Behalf Of Alois Treindl
Sent: Wednesday, August 07, 2013 6:09 AM
To: tz at iana.org
Subject: [tz] source code question regarding localtime.c PS
In localtime.c, function localsub() are these three lines of code:
1295 icycles = tcycles;
1296 if (tcycles - icycles >= 1 || icycles - tcycles >= 1)
1297 return NULL;
I do not understand the reason why lines 1296 and 1297 exist.
icycles and tcycles are equal.
Their difference is always zero. Why test for it being not zero?
PS: the reason why I am asking:
I try to understand the source code of zdump.c
It calls localtime() frequently, and has some cryptic code which depends
on whether localtime() returned NULL.
Therefore, I try to understand the conditions under which localtime()
returns NULL. If that would be documented somewhee (I may have
overlooked it), it would be great, as it is rather hard to understand it
out of the terse code.
More information about the tz
mailing list