Time zone definitions

Ray Osborn ROsborn at anl.gov
Wed Jan 5 16:39:03 GMT 2000


A question for the C experts.  When I was trying to get the time zone set
correctly using the Metrowerks CodeWarrior compiler on the Mac, I found that
tm_gmtoff is not included in the Mac's tm struct.  However, as you can see
in the version of NAPI.C that I committed to the server yesterday (search
for the __MWERKS__ ifdef), I was able to get around the problem by using the
time difference between the gmtime and localtime functions.

I've just been trying to find out why the CodeWarrior compiler, which claims
to be an ANSI C compiler doesn't define tm_gmtoff, and have concluded that
it is not standard (e.g. see
<http://www.ladseb.pd.cnr.it/usr/share/doclib/online/DOCS/HTML/AQTLTBTE/DOCU
_099.HTM#lib_date_sec>).  However, gmtime is standard.

I'm not absolutely sure about this because I don't have the ANSI C (or ISO
C) standard in front of me, but this web site seems to confirm this.  If
that's the case, isn't it safer to use the technique I have defined as the
default technique, and only use the ifdefs for the pathological non-ANSI
cases (e.g. DEC C v5)?

I presume that the tm_gmtoff is a GNU C extension to the ANSI C standard.
Is that right?

Any thoughts?
Ray
-- 
Dr Ray Osborn                Tel: +1 (630) 252-9011
Materials Science Division   Fax: +1 (630) 252-7777
Argonne National Laboratory  E-mail: ROsborn at anl.gov
Argonne, IL 60439-4845

 





More information about the NeXus-developers mailing list