Received: by 10.223.185.116 with SMTP id b49csp701485wrg; Wed, 21 Feb 2018 05:38:29 -0800 (PST) X-Google-Smtp-Source: AH8x227coRIHlKSV+5d5H4bNPq8kNTsZQj9A9PB/NCYyzu+DHMw89oS6uf6H6JVMnQcHeFQ8xuZZ X-Received: by 2002:a17:902:2f41:: with SMTP id s59-v6mr3263522plb.422.1519220309238; Wed, 21 Feb 2018 05:38:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519220309; cv=none; d=google.com; s=arc-20160816; b=auCcSGzNWZEYDDvdYo8iwkArfCFHGDIO5HBktqoBJ26gonL7QWODws9PMfyEFuxNlz w3lTcypQpJrik38ReaNKhmwCTcuVmwh/j3Kq+dSoLc0n481Gx5oWYdMFGHo1WIKcWjxI AOq5hP2C5+GmqZK6r/nabivKKeP6JeoWrcl1xwGye3ngf6zVDskernILWzEDZw2xM5aK Yx/b4c2TeArw9yWtkP43A9wSzemWWbfvk4uliYbhepApcyS8W4cbFiXbsjfDB7h/v5lA axxJdWxXYUhzGuyim/ZEHl96VgyCG+qi6/wLzq0fQBaPYIXaoPC3rl/bVLlW0dqT2YOE C3GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=1QIJA7q66t+4tjcjUld3Gmb9x4YZsT0y3swzGtbL38g=; b=QONkdtJm4s+jOIxLOefTTuz22BumZxy7/kTIWwb9yXr5bVLNcdhmATH4BZB1V2Ban7 u72poPJo/C69Ue6kp36i1g1i00SVvQ8dF/VQUdnYyvuQdS6+i/kRvUScAFsT7T7zZoyS 7QoRSBiREqAh49oadwQPF1iMGHpp1JaMnOwwxdvvpevRc4y6oLNxZOh9L9Bf9ppCOG+p oyunbXrpor59r+L14bgWszsU/KUo3nHmpnhLsuWMG/30mnNKVAeYLywByHGroWSaslJe cXsPcKuaQMCrfzb1iIandTzoUtAidcOa0OGNJriFTATzVLfuDnOdqM24OAgSZ3UccGKH eQhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23-v6si1706626pll.4.2018.02.21.05.38.13; Wed, 21 Feb 2018 05:38:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936530AbeBUNTn (ORCPT + 99 others); Wed, 21 Feb 2018 08:19:43 -0500 Received: from mga07.intel.com ([134.134.136.100]:47646 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933532AbeBUNTl (ORCPT ); Wed, 21 Feb 2018 08:19:41 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Feb 2018 05:19:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,543,1511856000"; d="scan'208";a="29582482" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by orsmga003.jf.intel.com with ESMTP; 21 Feb 2018 05:19:35 -0800 Message-ID: <1519219174.10722.21.camel@linux.intel.com> Subject: Re: [PATCH v2 01/21] lib/vsprintf: Print time and date in human readable format via %pt From: Andy Shevchenko To: Joe Perches , Rasmus Villemoes , Greg Kroah-Hartman , Andrew Morton , linux-kernel@vger.kernel.org, Alessandro Zummo , Alexandre Belloni , linux-rtc@vger.kernel.org, Arnd Bergmann , Mark Salyzyn Cc: Bartlomiej Zolnierkiewicz , Dmitry Torokhov , Geert Uytterhoeven , Guan Xuetao , Ingo Molnar , Jason Wessel , Jonathan Corbet , Jonathan Hunter , Krzysztof Kozlowski , "Rafael J. Wysocki" , Thierry Reding Date: Wed, 21 Feb 2018 15:19:34 +0200 In-Reply-To: <1519170907.4326.17.camel@perches.com> References: <20180220214400.66749-1-andriy.shevchenko@linux.intel.com> <20180220214400.66749-2-andriy.shevchenko@linux.intel.com> <1519170907.4326.17.camel@perches.com> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.5-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2018-02-20 at 15:55 -0800, Joe Perches wrote: > On Tue, 2018-02-20 at 23:43 +0200, 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 %ptR[dt][rv] > > specifier. > > > > Note, users have to select PRINTK_PEXT_TIMEDATE option in a Kconfig. > > Not sure this is a great option. > Not just the name, the need to select it. kbuildbot and some people complained about + text size. https://lists.01.org/pipermail/kbuild-all/2017-June/034950.html I would really like to compile it always. > > + int year = tm->tm_year + (r ? 0 : 1900); > > + int mon = tm->tm_mon + (r ? 0 : 1); > > What happens with negative values? Same as before. > Perhaps these temporaries should be unsigned int. No, the type of them is int, so, I'll keep it int. > > + if (unlikely(v && (unsigned int)tm->tm_min > 59)) > > leap seconds are allowed in the struct Alexandre answered already, but I would add that this is part of existing ABI, so, I wouldn't go to change this. -- Andy Shevchenko Intel Finland Oy