[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nmh-workers] Back to Dates
From: |
Ken Hornstein |
Subject: |
Re: [Nmh-workers] Back to Dates |
Date: |
Thu, 01 Jan 2015 17:20:35 -0500 |
>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