Mktime on systems with exotic time_t types
Paul Eggert
eggert at CS.UCLA.EDU
Tue Jan 11 23:39:02 UTC 2005
It's not clear to me that the algorithm will always terminate if
time_t is floating. For example, "++t; ++lo;" might have no effect if
t is a floating-point number.
Is it still your intent that the code be portable to K&R C?
Personally I don't think it's worth your time worrying about it any more,
but if you are worried, K&R C didn't have <float.h>, FLT_MAX, or DBL_MAX.
The only solid way to check this is to actually use a K&R C compiler,
but I haven't had easy access to one for years.
Here are some warnings from "gcc -Wall -W -O" that you might want to
attend to. The diagnostic for zdump.c:356 is a violation of the C
standard, so it's the most important.
localtime.c: In function `settzname':
localtime.c:225: warning: traditional C rejects ISO C style function definitions
localtime.c: In function `tzsetwall':
localtime.c:959: warning: traditional C rejects ISO C style function definitions
localtime.c: In function `tzset':
localtime.c:980: warning: traditional C rejects ISO C style function definitions
localtime.c: At top level:
localtime.c:1034: warning: unused parameter 'offset'
localtime.c: In function `localtime_r':
localtime.c:1092: warning: declaration of 'tm' shadows a global declaration
localtime.c:199: warning: shadowed declaration is here
localtime.c: In function `gmtime_r':
localtime.c:1154: warning: declaration of 'tm' shadows a global declaration
localtime.c:199: warning: shadowed declaration is here
localtime.c: In function `ctime_r':
localtime.c:1336: warning: declaration of 'tm' shadows a global declaration
localtime.c:199: warning: shadowed declaration is here
localtime.c: In function `time2sub':
localtime.c:1529: warning: declaration of 'i' shadows a previous local
localtime.c:1440: warning: shadowed declaration is here
localtime.c:1532: warning: comparison between signed and unsigned
localtime.c:1439: warning: unused variable `bits'
zdump.c: In function `main':
zdump.c:247: warning: declaration of 'c' shadows a previous local
zdump.c:199: warning: shadowed declaration is here
zdump.c: At top level:
zdump.c:356: warning: 'setabsolutes' was used with no prototype before its definition
zdump.c:362:34: warning: traditional C rejects the "F" suffix
zdump.c:363:33: warning: traditional C rejects the "F" suffix
More information about the tz
mailing list