Following on some discussions on the nmh list, I
observed a problem with the local time display
in exmh (which is doing what I think should be the
default for nmh - that is, displaying both th
original (sender) Date: header with the local time
appended.

Except that it wasn't working in the case that
raised the issue on the nmh list - messages with +0000
listed in the Date header - nor for that matter, any
other +NNNN zone (it worked fine for -NNNN and for
the alphabetic zone names from rfc822).

This looks like an underlying problem in tcl's
clock scan code - but in the case whre no format
string is provided, which the tcl doc says is
obsolete, and shouldn't be used.  Giving a suitable
format string (after a little massaging of the
input string to remove comments) seems to make it work.

Below is a patch that should fix it - along with not
displaying any local time in the case where the zone is
given as -0000 (ie: unknown).

kre

ps: Note that there's actually still a bug in the
unusual case where the sender's, and local, timezones
are different by exactly 24 hours - but that's so rare
it probably isn't worth fixing.
--- mime.tcl-save       2013-09-16 11:48:55.000000000 +0700
+++ mime.tcl    2014-12-16 08:59:57.000000000 +0700
@@ -1302,7 +1302,12 @@
     global mime
 
     catch {
-       set msgtime   [clock scan $time]
+       set msgtime   [regsub -all {\([^)]*\)} $time {}]
+       set msgtime   [string trim $msgtime]
+       if [regexp {.* -0000$} $msgtime] {
+           return
+       }
+       set msgtime   [clock scan $msgtime -format "%a, %d %b %Y %T %Z"]
        set localtime [clock format $msgtime -format " %T"]
        if { [string first $localtime $time] == -1 } {
            Preferences_Resource mime(localTimeFormat) localTimeFormat \
_______________________________________________
Nmh-workers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/nmh-workers

Reply via email to