aboutsummaryrefslogtreecommitdiff
path: root/libbutl/filesystem.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-03-19 23:53:12 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-03-20 01:58:10 +0300
commitb13cc702acf7a6b0a7f8ce3d69b2097a667ade92 (patch)
tree0c77a0b9409276e514678ed6d81c55acdeb4b52d /libbutl/filesystem.cxx
parentda7be5f8c18879d1ca21f76470fc83d2c5cbd1c4 (diff)
Fix compile-time errors when build with clang on MacOS
Diffstat (limited to 'libbutl/filesystem.cxx')
-rw-r--r--libbutl/filesystem.cxx14
1 files changed, 8 insertions, 6 deletions
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<duration> (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<usec_type> (nsec / 1000)};
- uint64_t msec (chrono::duration_cast<chrono::microseconds> (
+ uint64_t usec (chrono::duration_cast<chrono::microseconds> (
t.time_since_epoch ()).count ());
- return {static_cast<long> (msec / 1000000), // Seconds.
- static_cast<long> (msec % 1000000)}; // Microseconds.
+ return {static_cast<time_t> (usec / 1000000), // Seconds.
+ static_cast<usec_type> (usec % 1000000)}; // Microseconds.
};
timeval times[2];