date_time: UTC to local time conversion
Is there a function in date_time to do UTC to local time conversions? -- Cory Nelson http://www.int64.org
On Mon, 28 Feb 2005 18:09:21 -0800, Cory Nelson wrote
Is there a function in date_time to do UTC to local time conversions?
In 1.32 there are some primative tools to help your if you know things like
the timezone offset you want to convert from at compile time. See
http://www.boost.org/doc/html/date_time/posix_time.html#date_time.posix_time...
for more information.
In CVS, and should be ready for 1.33, there is a major new feature for local
times and dynamic timezones. In a nutshell you can convert to local time
using posix tz specifications or using a timezone database. So let's say you
have the local time in sydney austrialia and you want to convert to UTC:
//construct the tz for sydney au
boost::shared_ptr
Thanks, I'll check it out.
On Mon, 28 Feb 2005 19:48:36 -0700, Jeff Garland
On Mon, 28 Feb 2005 18:09:21 -0800, Cory Nelson wrote
Is there a function in date_time to do UTC to local time conversions?
In 1.32 there are some primative tools to help your if you know things like the timezone offset you want to convert from at compile time. See
http://www.boost.org/doc/html/date_time/posix_time.html#date_time.posix_time...
for more information.
In CVS, and should be ready for 1.33, there is a major new feature for local times and dynamic timezones. In a nutshell you can convert to local time using posix tz specifications or using a timezone database. So let's say you have the local time in sydney austrialia and you want to convert to UTC:
//construct the tz for sydney au boost::shared_ptr
sydney_tz(new posix_time_zone("EST+10EST,M10.5.0,M3.5.0/03:00")); date d(2004,Jan,1); time_duration td = hours(1) + minutes(15); //2004-Jan-1 01:15:00 in sydney local_date_time sidney_time(d,td,sydney_tz); ptime utc = sidney_time.utc_time(); //or the other way starting with a UTC time and going to local ptime some_utc_time(....); local_date_time sydney_time(some_utc_time, sydney_tz);
You can find the new online docs at: http://www.meta-comm.com/engineering/resources/cs-win32_metacomm/doc/html/da... Feedback appreciated.
Only warning is that we haven't worked out all the kinks in I/O and portability of this new code.
HTH,
Jeff _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Cory Nelson http://www.int64.org
participants (2)
-
Cory Nelson
-
Jeff Garland