c++ - boost 日期时间 : time_duration from seconds to multiple days

标签 c++ datetime boost

我知道我可以使用 boost::gregorian::date_duration 表示以天为单位的时间间隔,并使用 boost::posix_time::time_duration 表示时间间隔,但是有吗我可以使用一个简单的数据类型来表示从几秒到很多天的时间间隔?

boost::posix_time::time_duration 的限制(最大持续时间)是什么?

最佳答案

来自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.

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/

相关文章:

java - 我应该在 Java 8 中使用哪个日期类?

python - 如何在 python/pandas 中的毫秒部分中转换带有逗号 (,) 的日期时间字符串?

C++ 如何创建简单的二维区域松鸡算法?

c++ - 如何将派生对象传递给 C++ 中的类?

c++ - 从文件中读取数据并存储到结构数组中

使用静态变量的 C++ 继承成员函数

c++ - 具有 boost 变体的段错误

C++ 专门针对枚举的函数

c# - 如何通过格式将字符串转换为日期时间?

c++ - 带有非常量参数的 boost::bind 方法