我有很大的旧 C++ 项目。它至少有三个日期和时间结构。它们看起来像:
struct Date {
  int day;
  int month;
  int year;
};
struct Time {
  int hour;
  int min;
  int second;
};
其中一些使用双精度,用于 Time::second,其中一些具有“优化”并使用和的Time::(min, hour)缩写Date::(month, day)。
那么,现在有了新的 C++11 标准(并且可能会提升),是否可以用每个人都使用的东西来替换它们?
我确实看过std::chrono,但不知道如何使用它。
例如,为了说明我想要的测试用例:我有一个函数,我给Date这个函数提供坐标和坐标,它计算太阳何时升起,落下并返回两个Time结构。