summaryrefslogtreecommitdiffstats
path: root/modules/clock.py
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2009-06-18 14:20:12 +0100
committerSean B. Palmer <http://inamidst.com/sbp/>2009-06-18 14:20:12 +0100
commit5d48dd8ca7a317daf772d0627f0843d315c49876 (patch)
tree65244001e5d3a118cf7e29aeb5c5612016018551 /modules/clock.py
parentb35681c7593bc2935d1421d4de342a1453878445 (diff)
downloadbot-5d48dd8ca7a317daf772d0627f0843d315c49876.tar.gz
bot-5d48dd8ca7a317daf772d0627f0843d315c49876.tar.bz2
bot-5d48dd8ca7a317daf772d0627f0843d315c49876.zip
Run setup when reloading a module.
Diffstat (limited to 'modules/clock.py')
-rwxr-xr-xmodules/clock.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/modules/clock.py b/modules/clock.py
index 80d1c73..e648f41 100755
--- a/modules/clock.py
+++ b/modules/clock.py
@@ -7,7 +7,7 @@ Licensed under the Eiffel Forum License 2.
http://inamidst.com/phenny/
"""
-import math, time, urllib
+import re, math, time, urllib, locale
from tools import deprecated
TimeZones = {'KST': 9, 'CADT': 10.5, 'EETDST': 3, 'MESZ': 2, 'WADT': 9,
@@ -190,6 +190,8 @@ TZ3 = {
TimeZones.update(TZ1)
TimeZones.update(TZ3)
+r_local = re.compile(r'\([a-z]+_[A-Z]+\)')
+
@deprecated
def f_time(self, origin, match, args):
"""Returns the current time."""
@@ -211,6 +213,10 @@ def f_time(self, origin, match, args):
if (TZ == 'UTC') or (TZ == 'Z'):
msg = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
self.msg(origin.sender, msg)
+ elif r_local.match(tz): # thanks to Mark Shoulsdon (clsn)
+ locale.setlocale(locale.LC_TIME, (tz[1:-1], 'UTF-8'))
+ msg = time.strftime("%A, %d %B %Y %H:%M:%SZ", time.gmtime())
+ self.msg(origin.sender, msg)
elif TimeZones.has_key(TZ):
offset = TimeZones[TZ] * 3600
timenow = time.gmtime(time.time() + offset)