Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751591AbdFHUmq (ORCPT ); Thu, 8 Jun 2017 16:42:46 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:35561 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751477AbdFHUmo (ORCPT ); Thu, 8 Jun 2017 16:42:44 -0400 From: Rasmus Villemoes To: Andy Shevchenko Cc: Alexandre Belloni , Arnd Bergmann , Andy Shevchenko , Rasmus Villemoes , Greg Kroah-Hartman , Andrew Morton , Linux Kernel Mailing List , Alessandro Zummo , linux-rtc@vger.kernel.org, Bartlomiej Zolnierkiewicz , Dmitry Torokhov , Geert Uytterhoeven , Guan Xuetao , Ingo Molnar , Jason Wessel , Jonathan Corbet , Jonathan Hunter , Krzysztof Kozlowski , "Rafael J. Wysocki" Subject: Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt Organization: D03 References: <20170608134811.60786-1-andriy.shevchenko@linux.intel.com> <20170608134811.60786-5-andriy.shevchenko@linux.intel.com> <20170608150540.rek7a4akuxm3k36l@piout.net> <20170608184154.y7tqsv7ghpbcbf77@piout.net> X-Hashcash: 1:20:170608:jason.wessel@windriver.com::MYWfRhiyuCX/ZU8I:000000000000000000000000000000000000DJm X-Hashcash: 1:20:170608:gxt@mprc.pku.edu.cn::wJIA49PhTvAqwmNN:000000000000000000000000000000000000000000081i X-Hashcash: 1:20:170608:geert@linux-m68k.org::0QDgY43gso2BU0sA:0000000000000000000000000000000000000000003Wj X-Hashcash: 1:20:170608:andriy.shevchenko@linux.intel.com::9R6X4eTH+NrhpB7s:00000000000000000000000000000HRr X-Hashcash: 1:20:170608:andy.shevchenko@gmail.com::O/5RPzGBMLIVew+t:00000000000000000000000000000000000016sU X-Hashcash: 1:20:170608:jonathanh@nvidia.com::i3LgeowD/FwFRLb2:000000000000000000000000000000000000000000NiB X-Hashcash: 1:20:170608:mingo@kernel.org::ltCurldI1+KQpRMa:00xg0 X-Hashcash: 1:20:170608:rasmus.villemoes@prevas.dk::9bEN8cQxhiDdUCbY:000000000000000000000000000000000001ulq X-Hashcash: 1:20:170608:corbet@lwn.net::9U04A/w+0DLVdSZw:0001VdL X-Hashcash: 1:20:170608:dmitry.torokhov@gmail.com::MB82hZmAp4e6UIM5:0000000000000000000000000000000000001rQB X-Hashcash: 1:20:170608:arnd@arndb.de::iocOO22kPPtQp4vg:00002mln X-Hashcash: 1:20:170608:b.zolnierkie@samsung.com::hUqOLyFAtSaUwxag:00000000000000000000000000000000000002toJ X-Hashcash: 1:20:170608:linux-kernel@vger.kernel.org::PAWwCfXKSgKsbcPj:0000000000000000000000000000000004Jd2 X-Hashcash: 1:20:170608:rjw@rjwysocki.net::h//3pPIzRiJZJ0q1:000000000000000000000000000000000000000000004MUf X-Hashcash: 1:20:170608:linux-rtc@vger.kernel.org::n/6r5l1sskEw5nEM:0000000000000000000000000000000000005DpD X-Hashcash: 1:20:170608:krzk@kernel.org::3nWjuu6Wed+yDqQM:0077Qz X-Hashcash: 1:20:170608:a.zummo@towertech.it::q2icnDMGF4WY0/ma:000000000000000000000000000000000000000007XW1 X-Hashcash: 1:20:170608:akpm@linux-foundation.org::0fC9L16exufZwkMW:00000000000000000000000000000000000077Q9 X-Hashcash: 1:20:170608:alexandre.belloni@free-electrons.com::VId5kLyzJ6kJiE9n:00000000000000000000000007Tbx X-Hashcash: 1:20:170608:gregkh@linuxfoundation.org::lj4GV4Jr7XjlOY8G:000000000000000000000000000000000009F/S Date: Thu, 08 Jun 2017 22:42:40 +0200 In-Reply-To: (Andy Shevchenko's message of "Thu, 8 Jun 2017 21:49:33 +0300") Message-ID: <87wp8mky7z.fsf@rasmusvillemoes.dk> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1707 Lines: 50 On Thu, Jun 08 2017, Andy Shevchenko wrote: > On Thu, Jun 8, 2017 at 9:41 PM, Alexandre Belloni > wrote: >> On 08/06/2017 at 20:57:05 +0300, Andy Shevchenko wrote: >>> On Thu, Jun 8, 2017 at 6:05 PM, Alexandre Belloni >>> wrote: > >>> > I understand this may not fit your debugging needs but what about pretty >>> > printing time64_t and using rtc_tm_to_time64? >>> >>> There are two downsides as I can see: >>> 1) conversion to and from just for that; >> >> Those are almost all debug messages, I would be fine with that. > > Yeah, but the problem is to pass the reference. All dances around will > uglify the code. > (Obviously we can't pass timespec64/time64_t or anything longer than > 32 bits as is in %p extension) > I like that this gets rid of some mm/dd/yy and other more or less random format and ends up standardizing yyyy-mm-dd HH:MM:SS. However, I do think %pt should take either ktime_t or timespec64 (obviously by reference), with fx these options [ir] ISO (yyyy-mm-dd HH:MM:SS) or raw (seconds since epoch) [n] append nanoseconds (.%09ld). Please don't give people the option of eliding either the time or the date; I've spent too much time dealing with syslog files that don't include the year in the timestamps. Getting a timespec64* or ktime_t* from is not that bad. There's the compound literal option #define rtc_tm2timespec64p(tm) \ (&(struct timespec64){ .tv_sec = rtc_tm_to_time64(tm), .tv_nsec = 0 }) printk("%pt", rtc_tm2timespec64p(tm)) or the two-extra-lines per call-site struct timespec64 ts; rtc_tm2time64(tm, &ts) printk("%pt", &ts) Rasmus