Re: [Rd] Re: [R-SIG-Mac] Formatting of time zone for POSIXct

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Thu 20 Jan 2005 - 13:33:56 EST

On Jan 19, 2005, at 5:39 PM, Prof Brian Ripley wrote:

> There is _no_ tm_tzone component in a POSIX nor C99 tm structure (and
> I have just checked both), so if a system requires it to be set, the
> bug is not in R but in the standards-compliance of the system.

> I am happy to zero the structure, much less happy to reference
> undocumented non-POSIX/C99 components.

I'm completely happy with zeroing the structure as is seems to fix this standards-compliance problem for multiple platforms without the need to check for specific headers and behaviors. The only reason I attached the second solution was that I was perplexed why someone would use the complicated #ifdefs just to initialize a field to zero, so I thought there may be more to it...

AFAICS tm_zone and tm_gmoff are BSD extensions and obviously made it to GNU as well. Being extensions implies that a structure must be zeroed out before use, otherwise the implementation has no way of knowing whether the trailing values (wrt standard) are valid or not. If the various standards don't mention zeroing structures before use, then this may be interpreted as breaking POSIX/C99 standard, but nevertheless it still makes sense. Since it does no harm on POSIX platforms (just being redundant) and supports arbitrary extensions, I think we should go for it... just my two pennies ..

Cheers,
Simon



R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu Jan 20 12:43:30 2005

This archive was generated by hypermail 2.1.8 : Thu 20 Jan 2005 - 13:23:12 EST