Commit 7d91c025 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

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

parent 3a0cf931
...@@ -315,6 +315,8 @@ def collect_tkinter(info_add): ...@@ -315,6 +315,8 @@ def collect_tkinter(info_add):
def collect_time(info_add): def collect_time(info_add):
import time import time
info_add('time.time', time.time())
attributes = ( attributes = (
'altzone', 'altzone',
'daylight', 'daylight',
...@@ -326,7 +328,16 @@ def collect_time(info_add): ...@@ -326,7 +328,16 @@ def collect_time(info_add):
if hasattr(time, 'get_clock_info'): if hasattr(time, 'get_clock_info'):
for clock in ('time', 'perf_counter'): for clock in ('time', 'perf_counter'):
tinfo = time.get_clock_info(clock) 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): def collect_sysconfig(info_add):
...@@ -497,6 +508,7 @@ def collect_info(info): ...@@ -497,6 +508,7 @@ def collect_info(info):
collect_sys, collect_sys,
collect_sysconfig, collect_sysconfig,
collect_time, collect_time,
collect_datetime,
collect_tkinter, collect_tkinter,
collect_zlib, collect_zlib,
collect_expat, collect_expat,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment