我知道我可以使用 boost::gregorian::date_duration
表示以天为单位的时间间隔,并使用 boost::posix_time::time_duration
表示时间间隔,但是有吗我可以使用一个简单的数据类型来表示从几秒到很多天的时间间隔?
boost::posix_time::time_duration
的限制(最大持续时间)是什么?
最佳答案
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.
和
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.
因此,就您可能关心的而言,DevSolar 的答案在最后很好地总结了这一点。
关于c++ - boost 日期时间 : time_duration from seconds to multiple days,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15910797/