小编jon*_*rox的帖子

为什么 std::filesystem::file_time_type 中的 time_since_epoch() 为负数?

为什么下面的代码会输出负数?

coliru 链接可自行查看和编译代码。

#include <chrono>
#include <filesystem>
#include <iostream>

int main()
{
  std::cout << "Now: "
            << std::filesystem::file_time_type::clock().now().time_since_epoch().count()
            << "\n";
  return 0;
}
Run Code Online (Sandbox Code Playgroud)
Output:

Now: -4818978774392359625
Run Code Online (Sandbox Code Playgroud)

c++ filesystems time c++-chrono

10
推荐指数
1
解决办法
953
查看次数

标签 统计

c++ ×1

c++-chrono ×1

filesystems ×1

time ×1