Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751870AbdFHVZQ (ORCPT ); Thu, 8 Jun 2017 17:25:16 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:34303 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751813AbdFHVZO (ORCPT ); Thu, 8 Jun 2017 17:25:14 -0400 MIME-Version: 1.0 In-Reply-To: <87wp8mky7z.fsf@rasmusvillemoes.dk> 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> <87wp8mky7z.fsf@rasmusvillemoes.dk> From: Andy Shevchenko Date: Fri, 9 Jun 2017 00:25:13 +0300 Message-ID: Subject: Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt To: Rasmus Villemoes 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" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1829 Lines: 57 On Thu, Jun 8, 2017 at 11:42 PM, Rasmus Villemoes wrote: > 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: >> 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), I will try to look in this direction. > with fx these options > > [ir] ISO (yyyy-mm-dd HH:MM:SS) or raw (seconds since epoch) > [n] append nanoseconds (.%09ld). We still need to be able to print time *and/or* year groups separately. There are users which provide that via procfs or sysfs (ABI). > 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. I understand that, but see above. > Getting a timespec64* or ktime_t* from is not that > bad. There's the compound literal option Will look at it later, thanks for it. > > #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) -- With Best Regards, Andy Shevchenko