nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Back to Dates

2015-01-01 16:20:57
In the meantime, would somebody be willing to send me one that does
elapsed time? I don't much care about the time unit, though I prefer
days.

Here you go.  This comes courtesy of Oliver Kiddle; he sent this to me
in private email, but he did say he's fine with me making it more widely
available.  This is actually a line from a mhl file, but it should be
easy to adapt this to other places:

Date:formatfield="%<(nodate{text})%{text}%|%(pretty{text})%(date2local{text})  
[\
%02(hour{text}):%02(min{text})\
%<(rclock{text})%<(gt 8596800)%| - \
%<(gt 84600)%(void (plus 43200))%(divide 86400) day\
%?(gt 3300)%(void (plus 1800))%(divide 3600) hour\
%|%(void (plus 30))%(divide 60) minute%>%<(gt 1)s%> ago%>%>]%>"

This produces output like:

Fri, 26 Sep 2014 15:46:11 -0500
[16:46 - 97 days ago]

But there is a cutoff for messages older than 100 days (that's the
(gt 8596800) part); after that it just shows the time.  But I'll leave
the fine-tuning as an exercise for the reader :-)  It actually shouldn't
be hard with some reading of the mh-format man page and fmttest.

--Ken

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>