Boost logo

Boost Users :

From: Jeff Garland (jeff_at_[hidden])
Date: 2006-02-05 12:47:29


On Sat, 4 Feb 2006 12:10:54 -0500, Christian Henning wrote
> Hi there, I would like to know how to create a local_date_time
> object. The only thing I have is a UTC time object. How do I create
> a time_zone_ptr from the machine settings.

Hi Christian -

Unfortunately there isn't really a portable way to do this -- so there isn't
an 'out of the box solution'. The main issue is that most operating systems
don't provide sufficient time zone information to build a good timezone object
-- it's really all over the map -- or at least I haven't found a solution.

One way that this can be approached is to set the TZ (or some other)
environment variable on the machine to the appropriate posix TZ string and
then build one. You can do this portably accross OS's, but it requires
special administrative setup. Alternatively, you can use the time zone
database feature and set an environment setting that provides a region-based
string like AMERICA/NEW YORK which you can use to construct the appropriate tz
ptr.

HTH,

Jeff

 


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net