Patch from campey@informationlogistics.co.za: Use a simpler/cleaner
method to show the timestamp date difference of chat messages
This commit is contained in:
parent
2f56fbb5fd
commit
21ae29924b
1 changed files with 3 additions and 7 deletions
|
@ -34,6 +34,7 @@ import dialogs
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import helpers
|
from common import helpers
|
||||||
from common import i18n
|
from common import i18n
|
||||||
|
from calendar import timegm
|
||||||
|
|
||||||
_ = i18n._
|
_ = i18n._
|
||||||
APP = i18n.APP
|
APP = i18n.APP
|
||||||
|
@ -560,13 +561,8 @@ class ConversationTextview(gtk.TextView):
|
||||||
if gajim.config.get('print_time') == 'always':
|
if gajim.config.get('print_time') == 'always':
|
||||||
before_str = gajim.config.get('before_time')
|
before_str = gajim.config.get('before_time')
|
||||||
after_str = gajim.config.get('after_time')
|
after_str = gajim.config.get('after_time')
|
||||||
msg_day = time.strftime('%j', tim)
|
# get difference in days since epoch
|
||||||
day = time.strftime('%j')
|
diff_day = int(timegm(time.localtime()))/86400 - int(timegm(tim))/86400
|
||||||
diff_day = 0
|
|
||||||
while day != msg_day:
|
|
||||||
diff_day += 1
|
|
||||||
before_tim = time.localtime(time.time()-24*3600*diff_day)
|
|
||||||
day = time.strftime('%j', before_tim)
|
|
||||||
if diff_day == 0:
|
if diff_day == 0:
|
||||||
day_str = ''
|
day_str = ''
|
||||||
elif diff_day == 1:
|
elif diff_day == 1:
|
||||||
|
|
Loading…
Add table
Reference in a new issue