[date_time] Need help with a couple simple problems
I've spent a couple hours looking over the docs for the date-time library but still haven't been able to figure out how to do what I need to do. I'm hoping someone on this list can shed some light on how to solve my problems. I'm creating a logging system for our software and each log is timestamped. I want to store in a file the boost::posix_time::ptime of each log. I realize ptime supports boost::serialization, but we had to pull the boost::serialization code from our server because of really strange errors (DLL exceptions, DLLs getting unloaded while serializing, etc). What's the best way to serialize/deserialize a ptime? The file is in a binary format, so the most compact format is preferred. I'm storing the ptime for each log in UTC, however I would like to convert it to local time when the log is displayed. I saw all kinds of conversions to local time, but all of them had the time zone hard coded. Is there a simple way to just convert UTC to the time zone of the computer? Thanks for any and all help, Scott
#include "boost/date_time/local_time_adjustor.hpp" #include "boost/date_time/c_local_time_adjustor.hpp" ptime local_var =date_time::c_local_adjustor<ptime>::utc_to_local(utc_var); What do you mean by the file is in binary format? Jan
participants (2)
-
Jan Stetka
-
Scott