Skip to content

Commit 7d91c02

Browse files
authored
pythoninfo: add time.time and datetime.datetime.now (#5214)
1 parent 3a0cf93 commit 7d91c02

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

‎Lib/test/pythoninfo.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,8 @@ def collect_tkinter(info_add):
315315
def collect_time(info_add):
316316
import time
317317

318+
info_add('time.time', time.time())
319+
318320
attributes = (
319321
'altzone',
320322
'daylight',
@@ -326,7 +328,16 @@ def collect_time(info_add):
326328
if hasattr(time, 'get_clock_info'):
327329
for clock in ('time', 'perf_counter'):
328330
tinfo = time.get_clock_info(clock)
329-
info_add('time.%s' % clock, tinfo)
331+
info_add('time.get_clock_info(%s)' % clock, tinfo)
332+
333+
334+
def collect_datetime(info_add):
335+
try:
336+
import datetime
337+
except ImportError:
338+
return
339+
340+
info_add('datetime.datetime.now', datetime.datetime.now())
330341

331342

332343
def collect_sysconfig(info_add):
@@ -497,6 +508,7 @@ def collect_info(info):
497508
collect_sys,
498509
collect_sysconfig,
499510
collect_time,
511+
collect_datetime,
500512
collect_tkinter,
501513
collect_zlib,
502514
collect_expat,

0 commit comments

Comments
 (0)