[tz] question regarding 'timezone' variable

Christos Zoulas christos at zoulas.com
Wed Sep 2 06:13:35 UTC 2015


On Sep 1, 11:02pm, eggert at cs.ucla.edu (Paul Eggert) wrote:
-- Subject: Re: [tz] question regarding 'timezone' variable

| Christos Zoulas wrote:
| >          pt = _add(tzname[t->tm_isdst != 0],
| > ...
| >
| > How do you access tzname which is a global making sure that it does not
| > change under you by another thread?
| 
| You don't.  The code involving tzname isn't used on a system that has a working 
| tm_zone member.  Any system desiring thread-safety should have a struct tm with 
| both tm_zone and tm_gmtoff members, as NetBSD does.

Okay, but we should fix the NULL cases in strptime() then so that TM_ZONE
is never NULL?

christos

#ifdef TM_ZONE  
                                if (t->TM_ZONE != NULL)
                                        pt = _add(t->TM_ZONE, pt, ptlim);  
                                else
#endif /* defined TM_ZONE */
                                if (t->tm_isdst >= 0)
                                        pt = _add(tzname[t->tm_isdst != 0],
                                                pt, ptlim);




More information about the tz mailing list