After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 592238 - Simplify relative date calculation
Simplify relative date calculation
Status: RESOLVED OBSOLETE
Product: evolution
Classification: Applications
Component: Mailer
2.32.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: evolution-mail-maintainers
Evolution QA team
Depends on:
Blocks:
 
 
Reported: 2009-08-18 16:22 UTC by freggy1
Modified: 2021-05-19 11:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description freggy1 2009-08-18 16:22:07 UTC
I had Evolution running around midnight (midnight 17-18 August). Shortly after midnight 18 Aug, I noticed that mails send on 17 August were correctly indicated as being sent "Yesterday" in the Date column of Evolution's message list. However, mails sent on 16th of August, were also still being marked as being sent "Yesterday", which obviously is not correct anymore.

$ rpm -qa "*evolution*"
evolution-data-server-2.27.90-1mdv2010.0
evolution-exchange-2.27.90-1mdv2010.0
evolution-sharp-0.21.1-1mdv2010.0
evolution-2.27.90-2mdv2010.0
Comment 1 Stanislav Brabec 2009-10-07 14:21:05 UTC
Still valid for 2.27.92. Not over midnight. Even at 4pm, 7pm two days ago is still yesterday.

Please set it to Major. This type of bugs may easily cause attending meeting one day off.
Comment 2 Stanislav Brabec 2009-10-07 16:08:48 UTC
This seems to be fixed in version 2.28.0.

Keeping the bug opened anyway.

evolution has two different implementations of this, both are ugly (one incredibly), and none of them uses g_date_days_between(), which does exactly the same as 50% of both functions.


Regarding mail/message-list.c filter_date() (used in mail folder summary):

It implements "how many days are between date A and date B" as a task with linear complexity!

It uses buffer of static size for translatable string.


Regarding e-util/e-datetime-format.cformat_relative_date() (used in all other cases):

Moving if (ABS (diff) > 7) several lines up may save the g_free().

if (value->tm_year == today->tm_year... may be probably replaced by if (diff == 0)

if (diff <= 1) then it is yesterday. Maybe it works in this context, but it looks ugly.
Comment 3 Milan Crha 2010-10-01 09:54:04 UTC
(In reply to comment #2)
> Regarding mail/message-list.c filter_date() (used in mail folder summary):
> 
> It implements "how many days are between date A and date B" as a task with
> linear complexity!
> 
> It uses buffer of static size for translatable string.

Yes, I agree on both.

> Regarding e-util/e-datetime-format.cformat_relative_date() (used in all other
> cases):
> 
> Moving if (ABS (diff) > 7) several lines up may save the g_free().

No, it cannot.

> if (value->tm_year == today->tm_year... may be probably replaced by if
> (diff == 0)

Yes, can be.

> if (diff <= 1) then it is yesterday. Maybe it works in this context, but it
> looks ugly.

well, it's either "yesterday" or "tomorrow", and looking at it there's a bug, it should be:
   if (ABS (diff) <= 1)
or, if you wish,
   if (ABS (diff) == 1)

Right now, if I read the code properly, is everything in the future 7 days replaced with "Tomorrow", which is obviously not correct.

Stanislav, would you mind to create a patch for this?
Comment 4 André Klapper 2021-05-19 11:56:01 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. 
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/Community/GettingInTouch/BugReportingGuidelines
and create a new bug report ticket at
  https://gitlab.gnome.org/GNOME/evolution/-/issues/

Thank you for your understanding and your help.