From b13cc702acf7a6b0a7f8ce3d69b2097a667ade92 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 19 Mar 2018 23:53:12 +0300 Subject: Fix compile-time errors when build with clang on MacOS --- libbutl/filesystem.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'libbutl/filesystem.cxx') diff --git a/libbutl/filesystem.cxx b/libbutl/filesystem.cxx index a6c7ae8..6557e7a 100644 --- a/libbutl/filesystem.cxx +++ b/libbutl/filesystem.cxx @@ -653,7 +653,7 @@ namespace butl if (dir ? !S_ISDIR (s.st_mode) : !S_ISREG (s.st_mode)) return {timestamp_nonexistent, timestamp_nonexistent}; - auto tm = [] (time_t sec, uint64_t nsec) -> timestamp + auto tm = [] (time_t sec, auto nsec) -> timestamp { return system_clock::from_time_t (sec) + chrono::duration_cast (chrono::nanoseconds (nsec)); @@ -737,16 +737,18 @@ namespace butl // Note: timeval has the microsecond resolution. // - auto tm = [] (timestamp t, long sec, long nsec) -> timeval + auto tm = [] (timestamp t, time_t sec, auto nsec) -> timeval { + using usec_type = decltype (timeval::tv_usec); + if (t == timestamp_nonexistent) - return {sec, nsec / 1000}; // Filesystem entry current time. + return {sec, static_cast (nsec / 1000)}; - uint64_t msec (chrono::duration_cast ( + uint64_t usec (chrono::duration_cast ( t.time_since_epoch ()).count ()); - return {static_cast (msec / 1000000), // Seconds. - static_cast (msec % 1000000)}; // Microseconds. + return {static_cast (usec / 1000000), // Seconds. + static_cast (usec % 1000000)}; // Microseconds. }; timeval times[2]; -- cgit v1.1