util/ChronoUtil: new utility library for std::chrono

This commit is contained in:
Max Kellermann
2017-02-11 22:23:33 +01:00
parent 329c3ab21b
commit 4146475c73
3 changed files with 46 additions and 2 deletions

View File

@@ -33,6 +33,7 @@
#include "event/DeferredMonitor.hxx"
#include "thread/Mutex.hxx"
#include "thread/Cond.hxx"
#include "util/ChronoUtil.hxx"
#include "util/RuntimeError.hxx"
#include "util/StringCompare.hxx"
#include "util/TimeParser.hxx"
@@ -420,7 +421,7 @@ protected:
? StorageFileInfo::Type::DIRECTORY
: StorageFileInfo::Type::REGULAR;
info.size = r.length;
info.mtime = r.mtime > std::chrono::system_clock::time_point()
info.mtime = !IsNegative(r.mtime)
? std::chrono::system_clock::to_time_t(r.mtime)
: 0;
info.device = info.inode = 0;
@@ -517,7 +518,7 @@ protected:
? StorageFileInfo::Type::DIRECTORY
: StorageFileInfo::Type::REGULAR;
info.size = r.length;
info.mtime = r.mtime > std::chrono::system_clock::time_point()
info.mtime = !IsNegative(r.mtime)
? std::chrono::system_clock::to_time_t(r.mtime)
: 0;
info.device = info.inode = 0;