VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/BaseTools/Scripts/GetUtcDateTime.py@ 105681

最後變更 在這個檔案從105681是 105670,由 vboxsync 提交於 7 月 前

Devices/EFI/FirmwareNew: Merge edk2-stable-202405 and make it build on aarch64, bugref:4643

  • 屬性 svn:eol-style 設為 native
檔案大小: 1.7 KB
 
1## @file
2# Get current UTC date and time information and output as ascii code.
3#
4# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
5#
6# SPDX-License-Identifier: BSD-2-Clause-Patent
7#
8
9VersionNumber = '0.1'
10import sys
11import datetime
12import argparse
13
14def Main():
15 PARSER = argparse.ArgumentParser(
16 description='Retrieves UTC date and time information (output ordering: year, date, time) - Version ' + VersionNumber)
17 PARSER.add_argument('--year',
18 action='store_true',
19 help='Return UTC year of now. [Example output (2019): 39313032]')
20 PARSER.add_argument('--date',
21 action='store_true',
22 help='Return UTC date MMDD of now. [Example output (7th August): 37303830]')
23 PARSER.add_argument('--time',
24 action='store_true',
25 help='Return 24-hour-format UTC time HHMM of now. [Example output (14:25): 35323431]')
26
27 ARGS = PARSER.parse_args()
28 if len(sys.argv) == 1:
29 print ("ERROR: At least one argument is required!\n")
30 PARSER.print_help()
31
32 today = datetime.datetime.now(datetime.timezone.utc)
33 if ARGS.year:
34 ReversedNumber = str(today.year)[::-1]
35 print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
36 if ARGS.date:
37 ReversedNumber = str(today.strftime("%m%d"))[::-1]
38 print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
39 if ARGS.time:
40 ReversedNumber = str(today.strftime("%H%M"))[::-1]
41 print (''.join(hex(ord(HexString))[2:] for HexString in ReversedNumber))
42
43if __name__ == '__main__':
44 Main()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette