Boost logo

Boost Users :

From: Lothar Werzinger (lothar_at_[hidden])
Date: 2008-08-01 12:13:50


The constructor of local_date_time also behaves strangely, too:

according to the documentation the constructor that takes a posix_time::ptime
> The given time is expected to be UTC. Therefore, the given time will be
> adjusted according to the offset described in the time zone.

As you can see in the attached test the constructed local_date_time formats
correctly when printed but provides a wrong local time when the fields are
accessed.

$ /opt2/linux/ix86/bin/g++-4.3.1 -I/opt2/linux/x86_64/include/boost-1_36 -o
boost1 boost1.cpp && (./boost1; ./boost1 1; ./boost1 1 2; ./boost1 1 2 3)
testing testConstructor ...
expected=19
actual =18
boost1: boost1.cpp:110: void testConstructor(): Assertion
`(static_cast<int32_t>(19)) == (ldt.time_of_day().hours())' failed.
testing testInputIso ...
expected=18
actual =19
boost1: boost1.cpp:194: void testInputIso(): Assertion
`(static_cast<int32_t>(18)) == (ldt.utc_time().time_of_day().hours())'
failed.
testing testInputIsoWide ...
expected=18
actual =19
boost1: boost1.cpp:250: void testInputIsoWide(): Assertion
`(static_cast<int32_t>(18)) == (ldt.utc_time().time_of_day().hours())'
failed.
testing testOutputIso ...
testing testOutputIso OK

Lothar

-- 
Lothar Werzinger Dipl.-Ing. Univ.
framework & platform architect
Tradescape Inc. - Enabling Efficient Digital Marketplaces
1754 Technology Drive, Suite 128
San Jose, CA 95110
web: http://www.tradescape.biz



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