|
Boost : |
From: Bill Seymour (bill-at-the-office_at_[hidden])
Date: 2002-04-15 13:58:29
Jeff wrote:
>
> ... time zone support as described on that Wiki page
> is not part of the current library.
>
OK, then I abstain. 8-)
>
> Yes, I would almost always recommend storage of date/times
> as UTC if multiple time zones are involved. However, if our
> application only represents times in a single timezone
> (say one without DST) we might have to pay for a lot of
> unnecessary conversion.
>
Well, in the case you gave, since no conversion of any kind
is required, just /assume/ that you've got local time and
pay nothing. 8-)
In the case when some conversions are required, always
storing civil time as UTC means that you need to pay
only at I/O time (or perhaps when a civil time is constructed
from some representation that's assumed to be local time).
It seems to me that the "unnecessary" conversions are the ones
that must happen in order to do some calculation.
>
> Also, there still has to be a way to convert from UTC
> to local and back. To documentation / examples of this
> are at:
>
> http://www.crystalclearsoftware.com/libraries/gdtl/user_docs/local_time_adjust.html
>
Well, sure; but if the conversion happens only at I/O time,
then there's no requirement for the conversion to modify
the date/time object itself. In a datetime class that I use,
a datetime can be converted to/from a std::tm for I/O (the
library has no I/O of its own); and the conversion takes
an optional timezone object as an argument (defaults to UTC).
--Bill Seymour
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk