pythoninfo: add time.time and datetime.datetime.now (GH-5214) (#5219)

(cherry picked from commit 7d91c02504)
This commit is contained in:
Miss Islington (bot) 2018-01-17 08:36:04 -08:00 committed by Victor Stinner
parent c2740e8a26
commit 4e09c0c858
1 changed files with 13 additions and 1 deletions

View File

@ -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',
@ -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):
@ -497,6 +508,7 @@ def collect_info(info):
collect_sys,
collect_sysconfig,
collect_time,
collect_datetime,
collect_tkinter,
collect_zlib,
collect_expat,