【问题标题】:Boost 1.41.0 : boost::locale alternative?Boost 1.41.0 : boost::locale 替代方案?
【发布时间】:2023-03-21 15:13:01
【问题描述】:

在我的 CentOS 6.9 环境中, boost-devel 指的是 Boost 1.41.0 库。

问题是 boost:locale 不适用于我相对于特定时区的日期计算,因为 boost:locale 似乎是 Boost 1.4 附带的 8.0.

有没有其他方法可以用 1.41(或 Boost 的替代方法)做类似的事情?

// adding a day to now with timezone in mind
std::locale::global(...a specific locale...);
date_time now;
now = now + period:day();

【问题讨论】:

标签: c++ boost centos centos6


【解决方案1】:

您也许可以在 Centos 6 上使用 c++98 中提供的 std::locale。

在此处查看将语言环境格式时间解析为 std::time 的示例:http://www.cplusplus.com/reference/locale/time_get/get_date/

一旦你有时间在 std::time 你应该能够单独添加小时/分钟/秒等,或者你可以转换为自纪元以来的时间并以这种方式进行计算。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-18
    • 1970-01-01
    • 2012-02-10
    • 1970-01-01
    相关资源
    最近更新 更多