gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:51:01 24 4
gpt4 key购买 nike

我知道我可以使用 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com