[date_time] How to create a time_zone_ptr from the machine settings?
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. Thanks ahead, Christian
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
participants (2)
-
Christian Henning
-
Jeff Garland