From: Thomas Jarosch Date: Wed, 27 Mar 2019 09:38:41 +0000 (+0100) Subject: Fix compile warning X-Git-Tag: v2.11~1^2~8 X-Git-Url: http://developer.intra2net.com/git/?p=libi2ncommon;a=commitdiff_plain;h=fe377737ffcde4c100efa4a8d8808213f100c2b0 Fix compile warning timefunc.cpp: In function ‘boost::optional, std::allocator > > format_min_sec_msec(const timespec&)’: timefunc.cpp:1000: warning: '0' flag ignored with precision and ‘%d’ gnu_printf format Also fix small typos. --- diff --git a/src/timefunc.cpp b/src/timefunc.cpp index 0d2ee5d..69a50fb 100644 --- a/src/timefunc.cpp +++ b/src/timefunc.cpp @@ -868,7 +868,7 @@ namespace { * @param tm Time to format as broken-down \c struct tm. * @param date Include the day part ([-]YYYY-MM-DD). * @param time Include the time part (hh:mm:ss). - * @param tz Include the timezone ([±]ZZZZ); only heeded if + * @param tz Include the timezone ([±]ZZZZ); only needed if * \c time is requested as well. * * @return The formatted timestamp. @@ -890,7 +890,7 @@ std::string format_iso8601 (const struct tm &tm, const bool date, } /* - * The sign is *always* handled above so the formatted string her + * The sign is *always* handled above so the formatted string here * is always one character shorter. * */ const size_t n = strftime (start, iso8601::bufsize-1, format, &tmp); @@ -997,7 +997,7 @@ format_min_sec_msec (const struct timespec &ts) { char ms [4] = { '\0', '\0', '\0', '\0' }; - if (snprintf (ms, 4, "%0.3ld", ts.tv_nsec / 1000000) < 0) { + if (snprintf (ms, 4, "%.3ld", ts.tv_nsec / 1000000) < 0) { return boost::none; } diff --git a/src/timefunc.hxx b/src/timefunc.hxx index 5fd4911..9961b6c 100644 --- a/src/timefunc.hxx +++ b/src/timefunc.hxx @@ -344,7 +344,7 @@ namespace clock { * * POSIX defines the ns part as *long*. Technically, that means * that on machines where *sizeof long* equals *sizeof int*, it can - * represent only up to arund 2.1 seconds. In this range, the loop + * represent only up to around 2.1 seconds. In this range, the loop * version is most likely faster than division. However, since in * practice *long* is 8 bytes just about anywhere, we have to * handle greater dividends first.