Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/4.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiSabler <dissy@ya.ru>2014-05-29 21:36:34 +0400
committerdiSabler <dissy@ya.ru>2014-05-29 21:36:34 +0400
commitaff43b78c525740879b68ab291eb8cc9c265d81c (patch)
tree00b9d8a1a7af546f4e2b19fbe9505014fba76e9e
parent54e5590ce3b5e7ae572ab3a7d0d9e53a38113915 (diff)
fix: utc in tzo with xep-0202
-rw-r--r--plugins/iq.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/plugins/iq.py b/plugins/iq.py
index be1ab95..f6076bd 100644
--- a/plugins/iq.py
+++ b/plugins/iq.py
@@ -254,8 +254,9 @@ def utime_async(type, jid, nick, text, mode, is_answ):
else:
try:
ttup = isa[0].replace('T','-').replace('Z','').replace(':','-').split('-')+['0','0',str(tuple(time.localtime())[8])]
- lt = time.localtime(time.mktime([int(tmp.split('.',1)[0]) for tmp in ttup])+(int(isa[1].split(':')[0])*60+int(isa[1].split(':')[1]))*60)
- timeofset = float(isa[1].replace(':','.'))
+ tzo = '0:0' if isa[1] == 'Z' else isa[1]
+ lt = time.localtime(time.mktime([int(tmp.split('.',1)[0]) for tmp in ttup])+(int(tzo.split(':')[0])*60+int(tzo.split(':')[1]))*60)
+ timeofset = float(tzo.replace(':','.'))
if timeofset < 0: t_gmt = 'GMT%s' % int(timeofset)
else: t_gmt = 'GMT+%s' % int(timeofset)
if timeofset%1: t_gmt += ':%02d' % int((timeofset%1*60/100) * 100)