Skip to content

Commit

Permalink
pythoninfo: add time.time and datetime.datetime.now (python#5214)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner authored Jan 17, 2018
1 parent 3a0cf93 commit 7d91c02
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Lib/test/pythoninfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ def collect_tkinter(info_add):
def collect_time(info_add):
import time

info_add('time.time', time.time())

attributes = (
'altzone',
'daylight',
Expand All @@ -326,7 +328,16 @@ def collect_time(info_add):
if hasattr(time, 'get_clock_info'):
for clock in ('time', 'perf_counter'):
tinfo = time.get_clock_info(clock)
info_add('time.%s' % clock, tinfo)
info_add('time.get_clock_info(%s)' % clock, tinfo)


def collect_datetime(info_add):
try:
import datetime
except ImportError:
return

info_add('datetime.datetime.now', datetime.datetime.now())


def collect_sysconfig(info_add):
Expand Down Expand Up @@ -497,6 +508,7 @@ def collect_info(info):
collect_sys,
collect_sysconfig,
collect_time,
collect_datetime,
collect_tkinter,
collect_zlib,
collect_expat,
Expand Down

0 comments on commit 7d91c02

Please sign in to comment.