Bug 30298

Summary: shows wrong date for some messages
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: loggerAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED WONTFIX QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: nicolas, vitaly.minko
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard: review- (use GDateTime)
i915 platform: i915 features:
Attachments: proposed fix
updated patch

Description Guillaume Desmottes 2010-09-21 01:01:31 UTC
Original bug report: https://bugzilla.gnome.org/show_bug.cgi?id=619012

It seems like the logfile is saved in UTC-time, while the logviewer adjusts the
time to the local timezone. However, the date in the "Previous Conversations"
dialogue is not adjusted when in another timezone, i.e. UTC+0100.


Steps to reproduce:
1) Create a log file with the name "20100517.log" and the following content:

<?xml version='1.0' encoding='utf-8'?>
<?xml-stylesheet type="text/xsl" href="empathy-log.xsl"?>
<log>
<message time='20100517T23:45:00' cm_id='0' id='mail@example.com'
name='EmpTest' token='' isuser='true' type='normal'>This is just for
testing!</message>
</log>

2) Find the message in the "Previous Conversations" dialogue and notice the
date, both in the list of search results and the date picker.


Expected result:
The date should be 18.05.2010 when in UTC+0100.


Actual result:
The date shows 17.05.2010, although this is wrong.
Comment 1 Vitaly Minko 2010-09-23 07:42:07 UTC
Created attachment 38901 [details] [review]
proposed fix

The implemented approach is still the same:
1. Request messages for additional date (+/- 1 day depending on time zone) if
time zone offset is not zero.
2. Pass to the UI only messages from the selected local date (remove extra
messages).
Comment 2 Emilio Pozuelo Monfort 2010-12-06 11:28:46 UTC
Hi Vitaly,

Your patch doesn't work correctly for me. With it, if I have a test log on say, December 5 at 22.45, and I'm on GMT+1, it's shown on December 6, though it (correctly) says "December 5, 23.45". It should be shown on December 5th though.
Comment 3 Vitaly Minko 2010-12-26 06:28:28 UTC
Created attachment 41456 [details] [review]
updated patch
Comment 4 Vitaly Minko 2010-12-26 06:31:07 UTC
That was my mistake, sorry, fixed.
There was a similar issue in the _tpl_log_manager_get_dates, which is also fixed using the implemented approach.
Comment 5 Nicolas Dufresne 2011-03-28 09:12:25 UTC
Review of attachment 41456 [details] [review]:

datetime.c has been removed from 0.2.X branch. We strongly encourage using GDateTime instead. I don't know if this bug is still present in newer version, it it's still present, we need a new patch.
Comment 6 Vitaly Minko 2011-04-02 15:43:55 UTC
Well looking into this problem again I found that the log file mentioned in the description seems invalid (or obsolete) - the file name is wrong. Telepathy would save the log as 20100518.log despite of the fact, that the timestamp of the message is "20100517T23:45:00". So the file name is dependent on timezone, which is bad.

Therefore I suggest to fix this issue in the following way:
1. Make log file names independent from timezome.
2. Apply the approach implemented by the patch above to fix the wrong date in Empathy's log viewer.

Please let me know your opinion and then I'll update the patch.
Comment 7 Nicolas Dufresne 2011-04-03 10:10:04 UTC
Btw thanks for replying back.

(In reply to comment #6)
> Well looking into this problem again I found that the log file mentioned in the
> description seems invalid (or obsolete) - the file name is wrong. Telepathy
> would save the log as 20100518.log despite of the fact, that the timestamp of
> the message is "20100517T23:45:00". So the file name is dependent on timezone,
> which is bad.

I have not made my mind yet on this. I think the original author had in mind that the user will remember a message to be on a certain day (his local timezone day). But for ordering reason, and because authors of Logger travel a lot, it was decided that messages timestamps would me marked as UTC to avoid potential miss-ordering. It's possible that this is a mistake and that we should have also stored the message timezone, which would have given Empathy a maximum of tools to show it the right way.

I think all this is based on the fact that we would like to group the text messages base on conversation. But that concept of conversation start/stop does not really exist, you may start it in the morning, disconnect, come back, reply to your body (but he was off-line), then the next day he saw the message and replied.

I think anytime we focus on 1 message, we need direct before and after context to understand, not really a day division.

> 
> Therefore I suggest to fix this issue in the following way:
> 1. Make log file names independent from timezome.
> 2. Apply the approach implemented by the patch above to fix the wrong date in
> Empathy's log viewer.
> 
> Please let me know your opinion and then I'll update the patch.

I think I need to speak with Emilio (who is currently implementing the Log Viewer redesign, see https://bugzilla.gnome.org/show_bug.cgi?id=619866). Also, feel free to jump in the discussion, Emilio is pochu on IRC and I'm stormer, usually hanging on gimp.net #empathy and freenode #telepathy.
Comment 8 Nicolas Dufresne 2011-10-31 10:58:31 UTC
With crafted notion of conversation in the log viewer this is no longer a concern.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.