history time is now correct. fixed #1571
This commit is contained in:
parent
25e82efebf
commit
93351156a1
2 changed files with 8 additions and 7 deletions
|
@ -33,7 +33,7 @@
|
||||||
"""
|
"""
|
||||||
various useful functions
|
various useful functions
|
||||||
"""
|
"""
|
||||||
|
from datetime import datetime, timedelta
|
||||||
import base64
|
import base64
|
||||||
import os
|
import os
|
||||||
import mimetypes
|
import mimetypes
|
||||||
|
@ -44,6 +44,7 @@ import sys
|
||||||
import select
|
import select
|
||||||
import errno
|
import errno
|
||||||
import xmpp
|
import xmpp
|
||||||
|
import time
|
||||||
|
|
||||||
def debug(string):
|
def debug(string):
|
||||||
"""
|
"""
|
||||||
|
@ -261,7 +262,8 @@ def datetime_tuple(timestamp):
|
||||||
"""
|
"""
|
||||||
timestamp = timestamp.split('.')[0]
|
timestamp = timestamp.split('.')[0]
|
||||||
timestamp = timestamp.replace('-', '')
|
timestamp = timestamp.replace('-', '')
|
||||||
timestamp = timestamp.replace('z', '')
|
ret = datetime.strptime(timestamp, '%Y%m%dT%H:%M:%SZ')
|
||||||
timestamp = timestamp.replace('Z', '')
|
# convert UTC to local time, with DST etc.
|
||||||
from datetime import datetime
|
dst = timedelta(seconds=time.altzone)
|
||||||
return datetime.strptime(timestamp, '%Y%m%dT%H:%M:%S')
|
ret -= dst
|
||||||
|
return ret
|
||||||
|
|
|
@ -377,8 +377,7 @@ class Gui(object):
|
||||||
"""
|
"""
|
||||||
Display the message on the room window
|
Display the message on the room window
|
||||||
"""
|
"""
|
||||||
delay_tag = stanza.getTag('delay', namespace='urn:xmpp:delay')
|
if delay_tag:
|
||||||
if delay_tag and not date:
|
|
||||||
delayed = True
|
delayed = True
|
||||||
date = common.datetime_tuple(delay_tag.getAttr('stamp'))
|
date = common.datetime_tuple(delay_tag.getAttr('stamp'))
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue