From nobody Thu May 2 10:46:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45177+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45177+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565269115; cv=none; d=zoho.com; s=zohoarc; b=j5zHX6WCa7ugZ4M44lYUrp9sXhrw16GNoExBWMS6OmO06RMwV6Qp932CHMKp2FmJef0TWabIdvC1LhkwC3yGBL5OYgCVYwzFO3Zt582ur2k4K0mqJ8oZtpKLy76qBVFPXu8TDj5F+vNB3C9WmwAHb00ac/dSO/PlhpO5H+3P38E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565269115; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=Q4MX3Y7ti/HnXrH0q3Iz92LSyq4mn/1gaYfTiWVeCAg=; b=jLhvCnnURIxXRxkPJDsUK6H/wM6HISMjgF2ZpDtHdCH1a3wf65OaI56w1OhepECZV3g0bH+SGT2gYkiJzI2Q2/kCYumFVdDBib6Ii7ZeVn6nPRHPfsBb7UZXiqnmc/3h2FBOTsAiCmDHJ/3rmWQ/3iX7jWvaBemZVyQs7gD2rwQ= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45177+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 15652691156278.199545890821469; Thu, 8 Aug 2019 05:58:35 -0700 (PDT) Return-Path: X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by groups.io with SMTP; Thu, 08 Aug 2019 05:58:34 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2019 05:58:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,361,1559545200"; d="scan'208";a="165685441" X-Received: from cchiu4-mobl1.gar.corp.intel.com ([10.252.188.170]) by orsmga007.jf.intel.com with ESMTP; 08 Aug 2019 05:58:32 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [edk2-devel] [PATCH] BaseTools/Scripts: Add GetUtcDateTimer script. Date: Thu, 8 Aug 2019 20:58:07 +0800 Message-Id: <20190808125807.1840-1-chasel.chiu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,chasel.chiu@intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565269115; bh=BFxifiWNMwV12l9MySOSIDJ0y3BHQ37Z5r/h7Hv2bVE=; h=Cc:Date:From:Reply-To:Subject:To; b=gIsiaQIeAaSZDIW76pjUvB8CQbncDnWauA0IUqrLk+9t1a2PyE3l4vbg7hMm97pbgk4 gxml+1GNX+rZn/WIi5cYt6jYiqh2WmRyXoNN3H20KINFi0uIi07lCMVOWnSqOzLHKlLst XF3KPIQUHFp5Xp7WYo+rfpXMldo4QCBJuSw= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2067 A script that can return UTC date and time in ascii format which is convenient for patching build time information in any binary. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Chasel Chiu Reviewed-by: Bob Feng --- BaseTools/Scripts/GetUtcDateTime.py | 47 +++++++++++++++++++++++++++++++++= ++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/BaseTools/Scripts/GetUtcDateTime.py b/BaseTools/Scripts/GetUtc= DateTime.py new file mode 100644 index 0000000000..8b25a0a867 --- /dev/null +++ b/BaseTools/Scripts/GetUtcDateTime.py @@ -0,0 +1,47 @@ +## @file +# Get current UTC date and time information and output as ascii code. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +VersionNumber =3D '0.1' +import sys +import datetime + +def Usage(): + print ("GetUtcDateTime - Version " + VersionNumber) + print ("Usage:") + print ("GetUtcDateTime [type]") + print (" --year: Return UTC year of now") + print (" Example output (2019): 39313032") + print (" --date: Return UTC date MMDD of now") + print (" Example output (7th August): 37303830") + print (" --time: Return 24-hour-format UTC time HHMM of no= w") + print (" Example output (4:25): 35323430") + +def Main(): + if len(sys.argv) =3D=3D 1: + Usage() + return 0 + + today =3D datetime.datetime.utcnow() + if sys.argv[1].strip().lower() =3D=3D "--year": + ReversedNumber =3D str(today.year)[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber= )) + return 0 + if sys.argv[1].strip().lower() =3D=3D "--date": + ReversedNumber =3D str(today.strftime("%m%d"))[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber= )) + return 0 + if sys.argv[1].strip().lower() =3D=3D "--time": + ReversedNumber =3D str(today.strftime("%H%M"))[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber= )) + return 0 + else: + Usage() + return 0 + +if __name__ =3D=3D '__main__': + sys.exit(Main()) --=20 2.13.3.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45177): https://edk2.groups.io/g/devel/message/45177 Mute This Topic: https://groups.io/mt/32797962/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-