Ken Hornstein <kenh(_at_)pobox(_dot_)com> writes:
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.
Well... I'm trying.
If I put your recipe in /t/form1 (attached) and do
/usr/local/nmh/bin/scan -form /t/form1 22
where 22 is your message.
I get
Date:formatfield=""
and nothing else.
So, clearly, I'm doing something wrong. Evidently you didn't intend
your recipe to be a format file. But, then, what did you intend it to be?
Norman Shapiro
form1
Description: form1
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers