|
Boost Users : |
Subject: [Boost-users] [DateTime]: unexpected boost::local_time::bad_offset caught
From: Roland Bock (rbock_at_[hidden])
Date: 2008-09-30 09:30:37
Hi,
I stumbled over an inconsistency in the Boost::DateTime library. I
wanted to create a STL map of posix time zones. For this purpose, I
wrote a mini code generator:
----------------------------------------------------
tz_database tz_db;
tz_db.load_from_file("src/date_time_zonespec.csv");
vector<string> names = tz_db.region_list();
for (vector<string>::iterator it = names.begin();
it != names.end(); ++it)
cout << " timeZones.insert(pair<string, time_zone_ptr>(\""
<< *it << "\", "
<< "time_zone_ptr(new posix_time_zone(\""
<< tz_db.time_zone_from_region(*it)->to_posix_string()
<< "\"))));"
<< endl;
----------------------------------------------------
(Sorry for the bad formatting)
This created lines like the following:
----------------------------------------------------
timeZones.insert(pair<string, time_zone_ptr>("America/New_York",
time_zone_ptr(new
posix_time_zone("EST-05EDT+01,M3.2.0/02:00,M11.1.0/02:00"))));
[...]
timeZones.insert(pair<string, time_zone_ptr>("Pacific/Kiritimati",
time_zone_ptr(new posix_time_zone("LINT+14"))));
----------------------------------------------------
The latter (and three others) throws an instance of
boost::local_time::bad_offset.
Thus, I have posix four time zones from the date_time_zone_spec.csv
which can be written to a posix string, but the resulting string cannot
be used to create a new posix time zone.
Its certainly not critical for me. I currently have no need to use
Pacific time zones, but it looks like an error anyway.
Regards,
Roland
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