Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751806AbdFHPGF (ORCPT ); Thu, 8 Jun 2017 11:06:05 -0400 Received: from mail.free-electrons.com ([62.4.15.54]:34030 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751509AbdFHPFw (ORCPT ); Thu, 8 Jun 2017 11:05:52 -0400 Date: Thu, 8 Jun 2017 17:05:40 +0200 From: Alexandre Belloni To: Andy Shevchenko Cc: 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" , Thierry Reding Subject: Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt Message-ID: <20170608150540.rek7a4akuxm3k36l@piout.net> References: <20170608134811.60786-1-andriy.shevchenko@linux.intel.com> <20170608134811.60786-5-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1448 Lines: 35 On 08/06/2017 at 17:55:12 +0300, Andy Shevchenko wrote: > On Thu, Jun 8, 2017 at 5:49 PM, Arnd Bergmann wrote: > > On Thu, Jun 8, 2017 at 3:47 PM, Andy Shevchenko > > wrote: > >> There are users which print time and date represented by content of > >> struct rtc_time in human readable format. > >> > >> Instead of open coding that each time introduce %pt[dt][rv] specifier. > > > > I really like the idea, and the implementation seems fine for this use case, but > > before we reserve %pt for rtc_time, could we discuss whether we want > > that for printing struct tm, struct timespec64, time64_t or ktime_t instead? > > How many users? For struct tm it's somelike 4 (which want to print its content). > > > I can see good reasons for pretty-printing any of them, but the namespace for > > format strings is rather limited. > > > > struct rtc_time is almost the same as struct tm (the former has one extra > > member), so maybe we can actually define them to be the same and > > use one format string for both? > > The reason I decide to drop struct tm for now due to they are not > compatible and I have got an interesting bugs. > Verify tm_year member carefully. > I understand this may not fit your debugging needs but what about pretty printing time64_t and using rtc_tm_to_time64? -- Alexandre Belloni, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com