Re: [PATCH 08/12] clock_getres.2: Cast 'time_t' to 'intmax_t' for printf() and fix the length modifiers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Alejandro Colomar <colomar.6.4.3@xxxxxxxxx>, 2020-09-12, 01:14:
-    printf("%2ldh %2ldm %2lds", (ts.tv_sec % SECS_IN_DAY) / 3600,
-            (ts.tv_sec % 3600) / 60, ts.tv_sec % 60);
+    printf("%2jdh %2jdm %2jds",
+            (intmax_t) (ts.tv_sec % SECS_IN_DAY) / 3600,
+            (intmax_t) (ts.tv_sec % 3600) / 60,
+            (intmax_t) ts.tv_sec % 60);

All these numbers are small, so %d and int casts would do the trick.

--
Jakub Wilk



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux