FW: timezone code - re-entrancy issue

Robert Elz kre at munnari.OZ.AU
Thu Jan 15 07:29:50 UTC 2009


    Date:        Wed, 14 Jan 2009 18:49:10 -0500
    From:        lennox at cs.columbia.edu
    Message-ID:  <18798.31222.292955.425549 at amman.clic.cs.columbia.edu>

  | Actually, this isn't true -- tm_zone isn't safe if the value of the "TZ"
  | environment variable is changed.  (This is true even in single-threaded
  | code, in fact.)

Hmm - yes, that's non-trivial to fix as there's no tm_free() function.
Probably we'd need to simply retain all of the tzabbr lists, rather than
including them directly in the state struct), for all zones ever loaded
(just once, so we don't burn memory when returning to a zone for the
second time) and suffer the cost of that - which isn't much, as the string
size is small (typically < 20 bytes/zone, usually much less) and the
number of zones is bounded, the number actually used by an application
likely much smaller, so the total cost is going to be small.

kre




More information about the tz mailing list