GNOME Bugzilla – Bug 592238
Simplify relative date calculation
Last modified: 2021-05-19 11:56:01 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
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.
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.
(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?
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.