From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtprelay0077.hostedemail.com ([216.40.44.77]:51509 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751827AbdFHPsM (ORCPT ); Thu, 8 Jun 2017 11:48:12 -0400 Message-ID: <1496936886.1929.20.camel@perches.com> Subject: Re: [PATCH v1 04/25] lib/vsprintf: Print time and date in human readable format via %pt From: Joe Perches To: Arnd Bergmann , Andy Shevchenko Cc: Andy Shevchenko , Rasmus Villemoes , Greg Kroah-Hartman , Andrew Morton , Linux Kernel Mailing List , Alessandro Zummo , Alexandre Belloni , 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 Date: Thu, 08 Jun 2017 08:48:06 -0700 In-Reply-To: References: <20170608134811.60786-1-andriy.shevchenko@linux.intel.com> <20170608134811.60786-5-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset="ISO-8859-1" Mime-Version: 1.0 Sender: linux-rtc-owner@vger.kernel.org List-ID: On Thu, 2017-06-08 at 17:33 +0200, Arnd Bergmann wrote: > On Thu, Jun 8, 2017 at 4:55 PM, 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? > > It's hard to predict, I would assume we get more users once there is an > easy way to print the time. > > > For struct tm it's somelike 4 (which want to print its content). > > Good point. I notice that they all convert from time64_t or time_t into > struct tm immediately before printing it, so we can scratch that one > as long as there is a way to pretty-print a time64_t. We also don't > need to print a time_t as we want to kill that one off anyway. > > If we only care about printing time64_t and rtc_time, we can easily > use %pT for one and %pt for the other, but there may still be good > reasons to print a timespec64 or ktime_t. > > > I can see good reasons for pretty-printing any of them, but the namespace for > > > format strings is rather limited. The kernel already uses different types for the same leading letter. For instance: %pI4 vs %pI6, %pap vs %pad A single 't' letter could do reasonably well.