Reputation: 3256
I know I can use boost::gregorian::date_duration
for time intervals in days, and boost::posix_time::time_duration
for time intervals, but is there a simple data type I can use for anything from seconds to many days of time interval?
What are the limits (max duration) to boost::posix_time::time_duration
?
Upvotes: 2
Views: 1533
Reputation: 63745
From the documentation:
By default the posix_time system uses a 64 bit integer and a 32 bit integer internally to provide nano-second level resolutions -- 96 bits for each time value. As an alternative, a single 64 bit integer can be used to provide a microsecond level resolution. This alternative implementation may provide better performance and more compact memory usage for many applications that do not require nano-second resolutions.
and
The variable BOOST_DATE_TIME_POSIX_TIME_STD_CONFIG, as defined in build/Jamfile, selects between these options. To select the 64 bit integer implementation simply remove this define from the Jamfile.
So as far as you're probably concerned, DevSolar's answer summarizes it nicely at the end.
Upvotes: 1
Reputation: 70243
"POSIX time" usually means "seconds since January 1st, 1970", which is good until about 2037 if you're using a 32-bit value, much longer if you are using 64 bit. So without looking at the exact specs of Boost, I wouldn't worry too much about the limits of boost::posix_time::time_duration
.
Upvotes: 1