From 81df8c90bb7b8c542690f6032e9c38bc52f1ae68 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 20 Oct 2020 05:11:51 +0200 Subject: basic_types: [int64_t -> uint64_t] getCurrentMilliseconds() --- include/jau/basic_types.hpp | 2 +- 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( 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 -- cgit v1.2.3