Staging
v0.5.1
https://github.com/python/cpython
Raw File
Tip revision: 4e02a97bd786bde6485210bd1c0f36fdc8ea8a56 authored by cvs2svn on 12 August 1998, 02:38:11 UTC
This commit was manufactured by cvs2svn to create tag 'r152a1'.
Tip revision: 4e02a97
test_time.py
import time

time.altzone
time.clock()
t = time.time()
time.asctime(time.gmtime(t))
if time.ctime(t) <> time.asctime(time.localtime(t)):
    print 'time.ctime(t) <> time.asctime(time.localtime(t))'

time.daylight
if long(time.mktime(time.localtime(t))) <> long(t):
    print 'time.mktime(time.localtime(t)) <> t'

time.sleep(1.2)
tt = time.gmtime(t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
                  'j', 'm', 'M', 'p', 'S',
                  'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
    format = ' %' + directive
    try:
        time.strftime(format, tt)
    except ValueError:
        print 'conversion specifier:', format, ' failed.'

time.timezone
time.tzname

# expected errors
try:
    time.asctime(0)
except TypeError:
    pass

try:
    time.mktime((999999, 999999, 999999, 999999,
                 999999, 999999, 999999, 999999,
                 999999))
except OverflowError:
    pass
back to top