1996-12-06 23:30:07 +00:00
|
|
|
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
|
1997-12-08 21:48:01 +00:00
|
|
|
if long(time.mktime(time.localtime(t))) <> long(t):
|
1996-12-06 23:30:07 +00:00
|
|
|
print 'time.mktime(time.localtime(t)) <> t'
|
|
|
|
|
|
|
|
time.sleep(1.2)
|
|
|
|
tt = time.gmtime(t)
|
1997-02-20 16:23:01 +00:00
|
|
|
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
|
1998-03-26 19:42:58 +00:00
|
|
|
'j', 'm', 'M', 'p', 'S',
|
|
|
|
'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
|
1997-08-18 15:37:38 +00:00
|
|
|
format = ' %' + directive
|
|
|
|
try:
|
1998-03-26 19:42:58 +00:00
|
|
|
time.strftime(format, tt)
|
1997-08-18 15:37:38 +00:00
|
|
|
except ValueError:
|
1998-03-26 19:42:58 +00:00
|
|
|
print 'conversion specifier:', format, ' failed.'
|
1996-12-06 23:30:07 +00:00
|
|
|
|
|
|
|
time.timezone
|
|
|
|
time.tzname
|
|
|
|
|
|
|
|
# expected errors
|
|
|
|
try:
|
|
|
|
time.asctime(0)
|
|
|
|
except TypeError:
|
|
|
|
pass
|
|
|
|
|
|
|
|
try:
|
|
|
|
time.mktime((999999, 999999, 999999, 999999,
|
1998-03-26 19:42:58 +00:00
|
|
|
999999, 999999, 999999, 999999,
|
|
|
|
999999))
|
1996-12-06 23:30:07 +00:00
|
|
|
except OverflowError:
|
|
|
|
pass
|