T
Torsten Mueller
I am told to port a piece of code (some ten thousend lines) from
Boost.Date_Time to Boost.Chrono.
But ... the more I read the documentations and try out myself some
things I get a lot of questions.
The code uses absolute timestamps a lot. This is what
boost:
osix_time:
time implements excellently.
I must realize the following things:
- parse strings and fill up the values into ptime objects
- generate readable and technical strings based upon ptime instances
- serialize ptime obects into a binary file and read again on another
machine (no common clock (!) between the machines ...)
- store ptime values in an SQL database and read again
- handle DST in some aspects
- extract the date or the time or the day of week from a timestamp
I guess this all will really get very complicated using Boost.Chrono.
Boost.Chrono is designed for other purposes, mostly for handling
durations, where the absolute point in time does not much interest, but
much more the difference between two points. This is handy for timers
and measurement especially if thread based clocks are used, but not for
holding and especially manipulating date and time values. I even can't
print out a typical timestamp representation like
"2014-04-10T12:34:56.123456" from a boost::chrono::time_point without
starting a massive calculation based on the concrete epoch of it's
clock ...
Has anyone expierences with that?
Is Boost.Chrono the right way for me?
Is there any reason not to use Boost.Date_Time in future?
T.M.
Boost.Date_Time to Boost.Chrono.
But ... the more I read the documentations and try out myself some
things I get a lot of questions.
The code uses absolute timestamps a lot. This is what
boost:
I must realize the following things:
- parse strings and fill up the values into ptime objects
- generate readable and technical strings based upon ptime instances
- serialize ptime obects into a binary file and read again on another
machine (no common clock (!) between the machines ...)
- store ptime values in an SQL database and read again
- handle DST in some aspects
- extract the date or the time or the day of week from a timestamp
I guess this all will really get very complicated using Boost.Chrono.
Boost.Chrono is designed for other purposes, mostly for handling
durations, where the absolute point in time does not much interest, but
much more the difference between two points. This is handy for timers
and measurement especially if thread based clocks are used, but not for
holding and especially manipulating date and time values. I even can't
print out a typical timestamp representation like
"2014-04-10T12:34:56.123456" from a boost::chrono::time_point without
starting a massive calculation based on the concrete epoch of it's
clock ...
Has anyone expierences with that?
Is Boost.Chrono the right way for me?
Is there any reason not to use Boost.Date_Time in future?
T.M.