summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_time.py
blob: acc4d4106b8a99173084f348a24c574b2e194b3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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 int(time.mktime(time.localtime(t))) <> int(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