From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751543AbdFHXJb (ORCPT ); Thu, 8 Jun 2017 19:09:31 -0400 Received: from smtprelay0158.hostedemail.com ([216.40.44.158]:35200 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751392AbdFHXJ3 (ORCPT ); Thu, 8 Jun 2017 19:09:29 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:1960:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3868:3870:3871:3872:3874:4321:5007:6742:7514:7903:10004:10400:10848:11232:11658:11914:12043:12296:12663:12740:12760:12895:13160:13229:13255:13439:14181:14659:14721:21067:21080:21433:21611:21627:30054:30060:30069:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: toe21_3516c9aa78659 X-Filterd-Recvd-Size: 4212 Message-ID: <1496963363.1929.22.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: Andy Shevchenko , Arnd Bergmann 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 16:09:23 -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" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2017-06-08 at 21:02 +0300, Andy Shevchenko wrote: > On Thu, Jun 8, 2017 at 6:33 PM, 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: > > > > 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. > > So, at least for now we can guess using existing users, right? > > I don't check yet how to calculate those cases of time64_t, > timespec64, ktime_t and alike if they are about pretty ptintong time > and date. > I'm speculating that there are (almost) none. > > > > 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. > > No need, we may still use 3rd/4th letter in the format for that. > > %pt(t/d) time/date + whatever modifications, like raw, validate, timespec, etc. > > 's' for timespec64, for example. My preference would be for %pt[type] where is mandatory and could be: r for struct rtc_time 6 for time64_t k for ktime_t T for struct timespec64 etc and has an unspecified default of YYYY-MM-DD:hh:mm:ss Perhaps use the "date" formats without the leading % uses for for additional styles.