X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ftime.cpp;h=ca29b2d61891efad38919300ee6771cc70f7008d;hb=HEAD;hp=5155eb82cf1a74329fa7b0a94ca169e619a36ffa;hpb=28ab034a2c3582d07d3423d2d746731f87d3969f;p=lttng-tools.git diff --git a/src/common/time.cpp b/src/common/time.cpp index 5155eb82c..6caaf27ba 100644 --- a/src/common/time.cpp +++ b/src/common/time.cpp @@ -21,7 +21,7 @@ static bool utf8_output_supported; -bool locale_supports_utf8(void) +bool locale_supports_utf8() { return utf8_output_supported; } @@ -47,9 +47,9 @@ int timespec_to_ms(struct timespec ts, unsigned long *ms) struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2) { - uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t1.tv_nsec; - uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t2.tv_nsec; - uint64_t diff = std::max(ts1, ts2) - std::min(ts1, ts2); + const uint64_t ts1 = (uint64_t) t1.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t1.tv_nsec; + const uint64_t ts2 = (uint64_t) t2.tv_sec * (uint64_t) NSEC_PER_SEC + (uint64_t) t2.tv_nsec; + const uint64_t diff = std::max(ts1, ts2) - std::min(ts1, ts2); struct timespec res; res.tv_sec = diff / (uint64_t) NSEC_PER_SEC; @@ -57,9 +57,9 @@ struct timespec timespec_abs_diff(struct timespec t1, struct timespec t2) return res; } -static void __attribute__((constructor)) init_locale_utf8_support(void) +static void __attribute__((constructor)) init_locale_utf8_support() { - const char *program_locale = setlocale(LC_ALL, NULL); + const char *program_locale = setlocale(LC_ALL, nullptr); const char *lang = getenv("LANG"); if (program_locale && strstr(program_locale, "utf8")) {