diff options
author | Sven Gothel <[email protected]> | 2020-10-20 05:11:51 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-10-20 05:11:51 +0200 |
commit | 81df8c90bb7b8c542690f6032e9c38bc52f1ae68 (patch) | |
tree | 4543619b5adec35f3de3d75ea03609a5c2a8c586 | |
parent | 0814f8212ac1ec19fef79d8ed55a162d3d8583f3 (diff) |
basic_types: [int64_t -> uint64_t] getCurrentMilliseconds()
-rw-r--r-- | include/jau/basic_types.hpp | 2 | ||||
-rw-r--r-- | src/basic_types.cpp | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/include/jau/basic_types.hpp b/include/jau/basic_types.hpp index 75344d9..6fa0aca 100644 --- a/include/jau/basic_types.hpp +++ b/include/jau/basic_types.hpp @@ -42,7 +42,7 @@ namespace jau { /** * Returns current monotonic time in milliseconds. */ - int64_t getCurrentMilliseconds() noexcept; + uint64_t getCurrentMilliseconds() noexcept; #define E_FILE_LINE __FILE__,__LINE__ diff --git a/src/basic_types.cpp b/src/basic_types.cpp index 789b312..e872f69 100644 --- a/src/basic_types.cpp +++ b/src/basic_types.cpp @@ -44,10 +44,10 @@ static const int64_t MilliPerOne = 1000L; * clock_gettime seems to be well supported at least on kernel >= 4.4. * Only bfin and sh are missing, while ia64 seems to be complicated. */ -int64_t jau::getCurrentMilliseconds() noexcept { +uint64_t jau::getCurrentMilliseconds() noexcept { struct timespec t; clock_gettime(CLOCK_MONOTONIC, &t); - return t.tv_sec * MilliPerOne + t.tv_nsec / NanoPerMilli; + return static_cast<uint64_t>( t.tv_sec * MilliPerOne + t.tv_nsec / NanoPerMilli ); } jau::RuntimeException::RuntimeException(std::string const type, std::string const m, const char* file, int line) noexcept |