diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:07 +0200 |
commit | 88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170 (patch) | |
tree | c6c5babb49b90293380106b81ae5c446959ac70f /zen/tick_count.h | |
parent | 5.3 (diff) | |
download | FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.gz FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.tar.bz2 FreeFileSync-88a8b528e20013c0aa3cc6bcd9659b0b5ddd9170.zip |
5.4
Diffstat (limited to 'zen/tick_count.h')
-rw-r--r-- | zen/tick_count.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/zen/tick_count.h b/zen/tick_count.h index 37c7cc59..30b0295d 100644 --- a/zen/tick_count.h +++ b/zen/tick_count.h @@ -56,17 +56,17 @@ public: #endif TickVal() : val_() {} - TickVal(const NativeVal& val) : val_(val) {} + explicit TickVal(const NativeVal& val) : val_(val) {} inline friend std::int64_t operator-(const TickVal& lhs, const TickVal& rhs) { #ifdef FFS_WIN - assert_static(IsSignedInt<decltype(lhs.val_.QuadPart)>::value); + assert_static(IsSignedInt<decltype(lhs.val_.QuadPart)>::value); return lhs.val_.QuadPart - rhs.val_.QuadPart; #elif defined FFS_LINUX - assert_static(IsSignedInt<decltype(lhs.val_.tv_sec)>::value); - assert_static(IsSignedInt<decltype(lhs.val_.tv_nsec)>::value); + assert_static(IsSignedInt<decltype(lhs.val_.tv_sec)>::value); + assert_static(IsSignedInt<decltype(lhs.val_.tv_nsec)>::value); return static_cast<std::int64_t>(lhs.val_.tv_sec - rhs.val_.tv_sec) * 1000000000.0 + lhs.val_.tv_nsec - rhs.val_.tv_nsec; #endif } @@ -85,6 +85,7 @@ std::int64_t ticksPerSec() //return 0 on error LARGE_INTEGER frequency = {}; if (!::QueryPerformanceFrequency(&frequency)) return 0; + assert_static(sizeof(std::int64_t) >= sizeof(frequency.QuadPart)); return frequency.QuadPart; #elif defined FFS_LINUX @@ -107,7 +108,7 @@ TickVal getTicks() //return 0 on error if (::clock_gettime(CLOCK_MONOTONIC_RAW, &now) != 0) //CLOCK_MONOTONIC measures time reliably across processors! return TickVal(); #endif - return now; + return TickVal(now); } } |