30 Sep 15:26
[DateTime]: unexpected boost::local_time::bad_offset caught
From: Roland Bock <rbock <at> eudoxos.de>
Subject: [DateTime]: unexpected boost::local_time::bad_offset caught
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-09-30 13:30:37 GMT
Subject: [DateTime]: unexpected boost::local_time::bad_offset caught
Newsgroups: gmane.comp.lib.boost.user
Date: 2008-09-30 13:30:37 GMT
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"))));
[...]
(Continue reading)
RSS Feed