Fix compile warning
authorThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 27 Mar 2019 09:38:41 +0000 (10:38 +0100)
committerThomas Jarosch <thomas.jarosch@intra2net.com>
Wed, 27 Mar 2019 10:52:06 +0000 (11:52 +0100)
timefunc.cpp: In function ‘boost::optional<std::basic_string<char, std::char_traits<char>, std::allocator<char> > > format_min_sec_msec(const timespec&)’:
timefunc.cpp:1000: warning: '0' flag ignored with precision and ‘%d’ gnu_printf format

Also fix small typos.

src/timefunc.cpp
src/timefunc.hxx

index 0d2ee5d..69a50fb 100644 (file)
@@ -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;
     }
 
index 5fd4911..9961b6c 100644 (file)
@@ -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.