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:
Alex Mauer 2006-01-17 22:36:54 +00:00
parent 2f56fbb5fd
commit 21ae29924b
1 changed files with 3 additions and 7 deletions

View File

@ -34,6 +34,7 @@ import dialogs
from common import gajim
from common import helpers
from common import i18n
from calendar import timegm
_ = i18n._
APP = i18n.APP
@ -560,13 +561,8 @@ class ConversationTextview(gtk.TextView):
if gajim.config.get('print_time') == 'always':
before_str = gajim.config.get('before_time')
after_str = gajim.config.get('after_time')
msg_day = time.strftime('%j', tim)
day = time.strftime('%j')
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)
# get difference in days since epoch
diff_day = int(timegm(time.localtime()))/86400 - int(timegm(tim))/86400
if diff_day == 0:
day_str = ''
elif diff_day == 1: