[Users] FYI: Bad date formats and sorting...
H.Merijn Brand
h.m.brand at xs4all.nl
Wed Jun 1 08:01:42 CEST 2016
On Wed, 1 Jun 2016 07:42:49 +0200, Andrej Kacian <andrej at kacian.sk>
wrote:
> On Tue, 31 May 2016 19:26:24 -0400
> Pierre Fortin <pf at pfortin.com> wrote:
>
> > Yup... looked into the code and thought the best place to "fix" this
> > was as the message(s) arrived... I'm willing to give it a shot if someone
> > can point me to the right bit of code (inc.c?) where the message arrives
> > and just before it gets written, I can give it a try...
>
> We generally have a policy of not modifying contents of received
> messages, so instead of fixing the date, I think it would be better to
> just parse the obsolete date string correctly. Look in procheader.c,
> function procheader_scan_date_string().
>
> Regards,
I always add code there too, because I cannot stand AM/PM
@@ -820,6 +820,18 @@ static gint procheader_scan_date_string(const gchar *str,
day, month, year, hh, mm, ss);
if (result == 6) return 0;
+ result = sscanf(str, "%3s %3s %d %2d:%2d:%2d %d",
+ weekday, month, day, hh, mm, ss, year);
+ if (result == 7) return 0;
+
+ result = sscanf(str, "%3s, %d %3s %d %2d:%2d:%2d %2s",
+ weekday, day, month, year, hh, mm, ss, zone);
+ if (result == 7) {
+ if (*zone == 'P') hh = hh + 12;
+ *zone = (gchar)0;
+ return 0;
+ }
+
*ss = 0;
result = sscanf(str, "%10s %d %9s %d %2d:%2d %6s",
weekday, day, month, year, hh, mm, zone);
--
H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/
using perl5.00307 .. 5.23 porting perl5 on HP-UX, AIX, and openSUSE
http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/
http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.claws-mail.org/pipermail/users/attachments/20160601/c5071f6f/attachment.sig>
More information about the Users
mailing list