standardised multiline strings

This commit is contained in:
Luke Rogers 2012-03-13 00:36:58 +13:00
parent c108e8b4dd
commit b1dece0edd

View file

@ -197,28 +197,28 @@ def get_time(tz):
TZ = tz.upper() TZ = tz.upper()
if (TZ == 'UTC') or (TZ == 'Z'): if (TZ == 'UTC') or (TZ == 'Z'):
msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02 " msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02 " \
"GMT", time.gmtime()) "GMT", time.gmtime())
return msg return msg
elif r_local.match(tz): elif r_local.match(tz):
locale.setlocale(locale.LC_TIME, (tz[1:-1], 'UTF-8')) locale.setlocale(locale.LC_TIME, (tz[1:-1], 'UTF-8'))
msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02" msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02" \
+ str(TZ), time.gmtime()) + str(TZ), time.gmtime())
return msg return msg
elif TZ in TimeZones: elif TZ in TimeZones:
offset = TimeZones[TZ] * 3600 offset = TimeZones[TZ] * 3600
timenow = time.gmtime(time.time() + offset) timenow = time.gmtime(time.time() + offset)
msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02" msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in \x02" \
+ str(TZ), timenow) + str(TZ), timenow)
return msg return msg
elif tz and tz[0] in ('+', '-') and 4 <= len(tz) <= 6: elif tz and tz[0] in ('+', '-') and 4 <= len(tz) <= 6:
timenow = time.gmtime(time.time() + (int(tz[:3]) * 3600)) timenow = time.gmtime(time.time() + (int(tz[:3]) * 3600))
msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in\x02" msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in\x02" \
" GMT" + str(tz), timenow) " GMT" + str(tz), timenow)
return msg return msg
else: else:
timenow = time.gmtime(time.time() + (int(tz) * 3600)) timenow = time.gmtime(time.time() + (int(tz) * 3600))
msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in\x02" msg = time.strftime("\x02%I:%M%p\x02 %A - \x02Time\x02 in\x02" \
" GMT " + str(tz), timenow) " GMT " + str(tz), timenow)
return msg return msg