Using #undef correctly?

Sascha Wildner saw at online.de
Thu Sep 21 13:31:09 PDT 2006


walt wrote:
DragonFly defines 'timezone' as a character string in <time.h> but linux
expect the number of seconds west of UTC (hence the long).
I'm not trying for a definitive fix here, I'm just puzzled why my added
'#undef' failed to change anything.
Cluestick, please?
The 'timezone' it is choking on is the prototype for our timezone(3) 
function. timezone() is a function here and a variable in System V'ish 
environments.

The reason why your #undef didn't have an effect is that #undef is the 
counterpart to #define and the timezone prototype is just a normal 
prototype and not a #define'd preprocessor macro.

Might struct tm's tm_gmtoff field be of more use? Not sure about the 
"east/west of GMT" issue, though. See 
http://www.die.net/doc/linux/man/man3/timezone.3.html e.g. for Linux' 
timezone semantics.

Sascha

--
http://yoyodyne.ath.cx




More information about the Users mailing list