From nobody Thu Apr 25 07:54:08 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+45601+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+45601+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565778078; cv=none; d=zoho.com; s=zohoarc; b=DMSQfjK8zkE/YjA/gu+WCwuluvo5S/moR9/zDPXea4dgGboj1qQzgZkKjVJd9qXD4Bq3+m2Uioe7GMx/1K8L3GmSb50v4CrwcifrYR66Z+dJwKDFTdGEl2k/HE5+/oWfwtLfcr34R9cSdZq/wdtBkQM3apOxwe4IxHo5YZ8+3UE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565778078; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=gkJkJF33BJxt49OkNWasYTI+Ff3xk5QlAyui9zNnt24=; b=SqmIvlZIW6LH8sGEIAu4UbiScp6vQYSykvJ2ujEZXDtOGWRnzVYJM374XdDeZoBwgk8uf/lORApa7mLZ9hSiRkEZIbEqyYOAH9sfMEzbZKuA0GWmsVuvsqsVC9KF+M5LvmoD97lUC5sSkIo/ePmBlRMDsmGhw/jMe+AWVa7CmWA= 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+45601+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 1565778078214385.09089423389435; Wed, 14 Aug 2019 03:21:18 -0700 (PDT) Return-Path: X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by groups.io with SMTP; Wed, 14 Aug 2019 03:21:17 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Aug 2019 03:21:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,384,1559545200"; d="scan'208";a="376683166" X-Received: from cchiu4-mobl1.gar.corp.intel.com ([10.5.215.130]) by fmsmga006.fm.intel.com with ESMTP; 14 Aug 2019 03:21:15 -0700 From: "Chiu, Chasel" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Leif Lindholm Subject: [edk2-devel] [PATCH v2] BaseTools/Scripts: Add GetUtcDateTime script. Date: Wed, 14 Aug 2019 18:21:06 +0800 Message-Id: <20190814102106.9236-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=1565778077; bh=oVBzwyzZ9fhO2bXWHBLs+BD5dMnaHK2comz7goIRduI=; h=Cc:Date:From:Reply-To:Subject:To; b=pnDEdGi6r4yGtDnDFjF2PTt9I5wFMXNd+4BCTByhdqhHEftZglsS1B80puzvphhi4xs 5L5N1l3uE2bfoMLO5vVf8hIlc7AN28AJig6CH0kaTmDFJsVsfV3IstPMw/dh2gQiY+jIV ftj54O/3Ak67PflVLpmPdh4JATFu0WU2Lf0= 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 Cc: Leif Lindholm Signed-off-by: Chasel Chiu Acked-by: Leif Lindholm Reviewed-by: Bob Feng --- BaseTools/Scripts/GetUtcDateTime.py | 44 +++++++++++++++++++++++++++++++++= +++++++++++ 1 file changed, 44 insertions(+) diff --git a/BaseTools/Scripts/GetUtcDateTime.py b/BaseTools/Scripts/GetUtc= DateTime.py new file mode 100644 index 0000000000..3cfb6ac2ae --- /dev/null +++ b/BaseTools/Scripts/GetUtcDateTime.py @@ -0,0 +1,44 @@ +## @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 +import argparse + +def Main(): + PARSER =3D argparse.ArgumentParser( + description=3D'Retrieves UTC date and time information (output ord= ering: year, date, time) - Version ' + VersionNumber) + PARSER.add_argument('--year', + action=3D'store_true', + help=3D'Return UTC year of now. [Example output (2= 019): 39313032]') + PARSER.add_argument('--date', + action=3D'store_true', + help=3D'Return UTC date MMDD of now. [Example outp= ut (7th August): 37303830]') + PARSER.add_argument('--time', + action=3D'store_true', + help=3D'Return 24-hour-format UTC time HHMM of now= . [Example output (14:25): 35323431]') + + ARGS =3D PARSER.parse_args() + if len(sys.argv) =3D=3D 1: + print ("ERROR: At least one argument is required!\n") + PARSER.print_help() + + today =3D datetime.datetime.utcnow() + if ARGS.year: + ReversedNumber =3D str(today.year)[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNu= mber)) + if ARGS.date: + ReversedNumber =3D str(today.strftime("%m%d"))[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNu= mber)) + if ARGS.time: + ReversedNumber =3D str(today.strftime("%H%M"))[::-1] + print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNu= mber)) + +if __name__ =3D=3D '__main__': + 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 (#45601): https://edk2.groups.io/g/devel/message/45601 Mute This Topic: https://groups.io/mt/32862249/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-