Boost logo

Boost Users :

Subject: [Boost-users] Question with the date_time libraries: microsec_clock::local_time()
From: Kit Li (kwlthewb_at_[hidden])
Date: 2009-08-26 15:21:13


Hi,

I'm new to Boost and am trying to utilize the date_time libraries.  I'm trying use the library in XP.  Here's the code I'm testing:

ptime now = microsec_clock::local_time();
tz_database tz_db;
tz_db.load_from_file("c:/boost/libs/date_time/data/date_time_zonespec.csv");
 time_zone_ptr nyc = tz_db.time_zone_from_region("America/New_York");
 local_date_time ldt(now.date(),now.time_of_day(), nyc, true);
 stringstream ss;
local_time_facet* output_facet = new local_time_facet();
 ss.imbue(locale(locale::classic(), output_facet));
 output_facet->format("%Y%m%d, %H:%M:%S %F %z");
 ss.str("");
 ss << ldt;
 cout << ss.str() << endl;

The question i have is with "microsec_clock::local_time();".  I tested second_clock::local_time() and the time is correct, for example 20090826, 15:14:55 EDT.  However, when I use microsec_clock::local_time();, I'd get 19700506, 19:44:32.970074 EDT.  Is there a conversion somewhere that I'm missing?  Thanks for the help.

- Bill



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