3 ms·
Breaks past one month, unfortunately. I think, you want to take the difference and divide by 86400 to get the number of days. Then take the difference modulo 8
by kazinator 4y ago
Breaks past one month, unfortunately.
I think, you want to take the difference and divide by 86400 to get the number of days. Then take the difference modulo 86400 to get seconds in a day, and convert that to hours (minutes:seconds) via strftime string.
Proof of concept:
1> (let ((tdiff (- (time) (read (command-get-string "git log -1 --format=%ct")))))
(match (@days @secs) (trunc-rem tdiff 86400)
`(@{days}d @(time-string-utc secs `%H`)h ago)`))
"(627d 12h ago)"
- bloopernova 4y agodangit! I hadn't tried testing it on a repo with commits that far in the past (obviously) Thank you for the bug report and PR ;) I'll look at fixing it with your code.