building the NeXus api

Ray Osborn ROsborn at anl.gov
Mon Mar 13 17:19:10 GMT 2000


on 2000/03/13 11:53 AM, Eric Boucher at boucher at aps.anl.gov wrote:

> 
> Hi Ray,
> 
> I've downloaded the latest version of the api and I cannot build it on my
> system.
> 
> I got the following error:
> 
> napi.c: In function 'nxipoen_':
> napi.c:402: structure has no member named 'tm_gmtoff'
> 
> 
> I'm trying to build it on solaris 2.6.
> What should I do to correct the problem ?
> 

We've had some trouble finding a completely portable way of setting the time
zone information when we open a new NeXus file (the current time is stored
as a global attribute).  You will find that the routine NXopen in napi.c has
a mass of preprocessor variables which we hoped would work with all systems.
The problem is that the 'tm' struct often has the member 'tm_gmtoff', but it
is not strictly a part of the ISO C standard as we had originally thought.
Some ISO C-compliant compilers, such as Metrowerks Codewarrior, complained.
I guess yours is another.

At about line 400 of napi.c, within NXopen, you will find the following
lines :

#elif (defined(__MWERKS__) || defined(_WIN32))
   gmt_offset = difftime (timer, mktime(gmtime(&timer)));
#else
   gmt_offset = time_info->tm_gmtoff;
#endif

I would suggest replacing this with

#else
   gmt_offset = difftime (timer, mktime(gmtime(&timer)));
#endif

Although this is only invoked on Macs and Windows machines, I think that it
is the only truly ISO C-compliant method of defining gmt_offset, so it
should work for you as well.  If it does, we will consider making it the
default method for the other machines.

Let us know what happens.

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 mailing list