Paste number 81869: clock diff

Paste number 81869: clock diff
Pasted by: clsn
When:2 years, 7 months ago
Share:Tweet this! | http://paste.lisp.org/+1R65
Channel:#swhack
Paste contents:
Raw Source | XML | Display As
*** sbpclock.py 2009-06-07 05:08:08.000000000 -0400
--- clock.py    2009-06-15 00:13:06.000000000 -0400
***************
*** 1,13 ****
  #!/usr/bin/env python
  """
  clock.py - Phenny Clock Module
! Copyright 2008-9, Sean B. Palmer, inamidst.com
  Licensed under the Eiffel Forum License 2.
  
  http://inamidst.com/phenny/
  """
  
  import math, time, urllib
  from tools import deprecated
  
  TimeZones = {'KST': 9, 'CADT': 10.5, 'EETDST': 3, 'MESZ': 2, 'WADT': 9, 
--- 1,14 ----
  #!/usr/bin/env python
  """
  clock.py - Phenny Clock Module
! Copyright 2008, Sean B. Palmer, inamidst.com
  Licensed under the Eiffel Forum License 2.
  
  http://inamidst.com/phenny/
  """
  
  import math, time, urllib
+ import re as REE
  from tools import deprecated
  
  TimeZones = {'KST': 9, 'CADT': 10.5, 'EETDST': 3, 'MESZ': 2, 'WADT': 9, 
***************
*** 211,216 ****
--- 212,222 ----
     if (TZ == 'UTC') or (TZ == 'Z'): 
        msg = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
        self.msg(origin.sender, msg)
+    elif REE.match(r"\([a-z]+_[A-Z]+\)$",tz):
+       import locale
+       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)

This paste has no annotations.

Colorize as:
Show Line Numbers

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.