gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimeZone.m: reference to a variable "daylight"


From: Richard Frith-Macdonald
Subject: Re: NSTimeZone.m: reference to a variable "daylight"
Date: Fri, 17 May 2013 14:37:56 +0100

On 16 May 2013, at 09:55, Ivan Vučica <address@hidden> wrote:

> Hi all,
> 
> some more Android related woes.
> 
> Making all for library libgnustep-base...
>  Compiling file NSTimeZone.m ...
> NSTimeZone.m:1644:56: error: use of undeclared identifier 'daylight'
>           if (NULL != tzname[0] && '\0' != *tzname[0] && 0 == daylight)
> 
> This is the context:
> 
> #if HAVE_TZSET && !defined(__FreeBSD__) && !defined(__OpenBSD__)
>       /*
>        * Try to get timezone from tzset and tzname/daylight.
>        * If daylight is non-zero, then tzname[0] is only the name
>        * the the zone for part of the year, so we can't use it as
>        * the definitive zone.
>        *
>        * FreeBSD doesn't implement TZSet fully, so we can't use it there.
>        * Apparently, OpenBSD neither.
>        */
>       if (localZoneString == nil)
>         {
>           localZoneSource = @"function: 'tzset()/tzname'";
>           tzset();
>           if (NULL != tzname[0] && '\0' != *tzname[0] && 0 == daylight)
>             localZoneString = [NSString stringWithUTF8String: tzname[0]];
>         }
> #endif
> 
> I can't exactly figure out what the "daylight" variable should be; it doesn't 
> seem to be an ivar, not a static variable. In the interest of making progress 
> on the Android build, I'm commenting it out, but I'm not sure where it came 
> from. It's obviously dead code on the most used platforms, but it's breaking 
> Android.
> 
> Is it perhaps the "extern int daylight" apparently present in time.h?
>     http://unixhelp.ed.ac.uk/CGI/man-cgi?tzset+3
> If so, should I simply add "&& !defined(ANDROID)"? Should this perhaps be 
> added as a test to configure.ac?

Yes, daylight is a global variable specified by POSIX to contain non-zero if 
daylight savings time is in use and 0 if it is not.  It should be available on 
any POSIX compliant system.
I think it would be better to add a test for it in configure.ac (since it seems 
that with Android there are now three operarting systems that don' have it ... 
and it starts to get cumbersome putting specific operating system checks in the 
code), but if that's too much work, a test for android would do.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]