Subject: Re: [boost] boost::gregorian::to_tm() initializes some fields of struct tm, but not all
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2009-02-07 09:46:13
Dmitry Goncharov wrote:
> boost::gregorian::to_tm() initializes some fields of struct tm, but not
> all. Implementations keep there additional fields.
> Besides the fields defined by POSIX libc2.9 has two additional fields in
> struct tm:
> struct tm
> #ifdef __USE_BSD
> long int tm_gmtoff; /* Seconds east of UTC. */
> __const char *tm_zone; /* Timezone abbreviation. */
> long int __tm_gmtoff; /* Seconds east of UTC. */
> __const char *__tm_zone; /* Timezone abbreviation. */
> There are two additional fields tm_gmtoff and tm_zone.
> boost::gregorian::to_tm() does not initialize tm_zone and tm_gmtoff.
> There are functions as well which use these additional fields.
> E.g. this is a piece of code from the implementation of strftime() from
> static size_t
> __strftime_internal (s, maxsize, format, tp, tzset_called ut_argument
> zone = (const char *) tp->tm_zone;
> #if HAVE_TZNAME
> if (ut)
> if (! (zone && *zone))
> zone = "GMT";
> This function dereferences tp->tm_zone.
> I have not created a ticker since this could be an already known issue.
I believe, this is mentioned here:
This issue is not fixed yet.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk