20 Aug
2010
20 Aug
'10
3:23 p.m.
[I am using Boost 1.43.0 on linux, gcc 4.4.1] I am having trouble with date_time's ptime. I am passing it a time_t, and store that in a ptime object. When I retrieve the time_t, I am getting a different value than the one I passed to it originally. (the difference seems to be 2 hours - in all probability due to UTC vs local time issues). Code: time_t now = time(NULL); boost::posix_time::ptime pt = boost::posix_time::from_time_t(now); struct tm tm = to_tm(pt); time_t should_be_now = mktime(&tm); BOOST_CHECK_EQUAL(now, should_be_now); fails for me: now is by 7200 seconds (i.e. 2 hours) ahead of. Is this a bug in date_time or am I just failing to use it properly? Thank you, and best regards Christoph