Re: AW: AW: AW: Re: tinterval - operator problems on AIX

Поиск
Список
Период
Сортировка
От Thomas Lockhart
Тема Re: AW: AW: AW: Re: tinterval - operator problems on AIX
Дата
Msg-id 3A5DE3FD.40C5DBB7@alumni.caltech.edu
обсуждение исходный текст
Ответ на AW: AW: AW: Re: tinterval - operator problems on AIX  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
Список pgsql-hackers
> > How about having some #if BROKEN_TIMEZONE_DATABASE code which uses both
> > mktime() and localtime() to derive the correct time zone? That is, call
> > mktime to get a time_t, then call localtime() to get the time zone info,
> > but only on platforms which do not get a complete result from just the
> > call to mktime(). In fact, we *could* check for tm->tm_isdst coming back
> > "-1" for every platform, then call localtime() to make a last stab at
> > getting a good value.
> How would we construct a valid time_t from the struct tm without mktime?

If I understand the info you have given previously, it should be
possible to get a valid tm->tm_isdst by the following sequence of calls:

// call mktime() which might return a "-1" for DST
time = mktime(tm);
// time is now a correct GMT time
// localtime() *is* allowed to return a good tm->tm_isdst
// even for "negative" time_t values.
// I thought I understood this from Andreas' info...
newtm = localtime(time);
// use the new flag for something useful...
dstflag = newtm->tm_isdst;

Yes?
                     - Thomas


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Zeugswetter Andreas SB
Дата:
Сообщение: AW: AW: AW: Re: tinterval - operator problems on AIX
Следующее
От: Thomas Lockhart
Дата:
Сообщение: Re: AW: Re: tinterval - operator problems on AIX