Commit e7038425 authored by Guido van Rossum's avatar Guido van Rossum

Tweaks to cope with strftime returning 0 without error for %Z

parent f07eaea1
...@@ -69,7 +69,7 @@ def strftest(now): ...@@ -69,7 +69,7 @@ def strftest(now):
nonstandard_expectations = ( nonstandard_expectations = (
# These are standard but don't have predictable output # These are standard but don't have predictable output
('%c', fixasctime(time.asctime(now)), 'near-asctime() format'), ('%c', fixasctime(time.asctime(now)), 'near-asctime() format'),
('%Z', tz, 'time zone name'), ('(%Z)', '(%s)' % tz, 'time zone name'),
# These are some platform specific extensions # These are some platform specific extensions
('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'), ('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'),
......
...@@ -16,8 +16,11 @@ tt = time.gmtime(t) ...@@ -16,8 +16,11 @@ tt = time.gmtime(t)
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I', for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
'j', 'm', 'M', 'p', 'S', 'j', 'm', 'M', 'p', 'S',
'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'): 'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
format = '%' + directive format = ' %' + directive
try:
time.strftime(format, tt) time.strftime(format, tt)
except ValueError:
print 'conversion specifier:', format, ' failed.'
time.timezone time.timezone
time.tzname time.tzname
......
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