Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 1 | import time |
| 2 | |
| 3 | time.altzone |
| 4 | time.clock() |
| 5 | t = time.time() |
| 6 | time.asctime(time.gmtime(t)) |
| 7 | if time.ctime(t) <> time.asctime(time.localtime(t)): |
| 8 | print 'time.ctime(t) <> time.asctime(time.localtime(t))' |
| 9 | |
| 10 | time.daylight |
Guido van Rossum | 6a99984 | 1997-12-08 21:48:01 +0000 | [diff] [blame] | 11 | if long(time.mktime(time.localtime(t))) <> long(t): |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 12 | print 'time.mktime(time.localtime(t)) <> t' |
| 13 | |
| 14 | time.sleep(1.2) |
| 15 | tt = time.gmtime(t) |
Guido van Rossum | ad183bb | 1997-02-20 16:23:01 +0000 | [diff] [blame] | 16 | for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', |
Guido van Rossum | 41360a4 | 1998-03-26 19:42:58 +0000 | [diff] [blame] | 17 | 'j', 'm', 'M', 'p', 'S', |
| 18 | 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): |
Guido van Rossum | e703842 | 1997-08-18 15:37:38 +0000 | [diff] [blame] | 19 | format = ' %' + directive |
| 20 | try: |
Guido van Rossum | 41360a4 | 1998-03-26 19:42:58 +0000 | [diff] [blame] | 21 | time.strftime(format, tt) |
Guido van Rossum | e703842 | 1997-08-18 15:37:38 +0000 | [diff] [blame] | 22 | except ValueError: |
Guido van Rossum | 41360a4 | 1998-03-26 19:42:58 +0000 | [diff] [blame] | 23 | print 'conversion specifier:', format, ' failed.' |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 24 | |
| 25 | time.timezone |
| 26 | time.tzname |
| 27 | |
| 28 | # expected errors |
| 29 | try: |
| 30 | time.asctime(0) |
| 31 | except TypeError: |
| 32 | pass |
| 33 | |
| 34 | try: |
| 35 | time.mktime((999999, 999999, 999999, 999999, |
Guido van Rossum | 41360a4 | 1998-03-26 19:42:58 +0000 | [diff] [blame] | 36 | 999999, 999999, 999999, 999999, |
| 37 | 999999)) |
Barry Warsaw | b0c2232 | 1996-12-06 23:30:07 +0000 | [diff] [blame] | 38 | except OverflowError: |
| 39 | pass |