From b8e33ff1f3231aa5dd84b27fc53c8bf4ace2da90 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Wed, 5 Oct 2022 23:36:30 -0400 Subject: Fix same month, different day diffs This fixes it expressing a 355d difference, for example, as 1y -1m 20d. Just switching to <= would make it express 365d as 12m rather than 1y. --- bin/when.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bin/when.y') diff --git a/bin/when.y b/bin/when.y index c94c5514..46651ebb 100644 --- a/bin/when.y +++ b/bin/when.y @@ -121,7 +121,10 @@ static struct tm dateDiff(struct tm a, struct tm b) { .tm_mon = a.tm_mon - b.tm_mon, .tm_mday = a.tm_mday - b.tm_mday, }; - if (a.tm_mon < b.tm_mon) { + if ( + a.tm_mon < b.tm_mon || + (a.tm_mon == b.tm_mon && a.tm_mday < b.tm_mday) + ) { diff.tm_year--; diff.tm_mon += 12; } -- cgit 1.4.1 >dontfiles
summary refs log tree commit diff
path: root/doc/zlib/compress.3 (unfollow)
Commit message (Expand)Author
2022-04-20Set txt mtimes to source mtimesJune McEnroe
2022-04-20Make (pun) the dependencies make (pun) more senseJune McEnroe
2022-04-17Add HenchJune McEnroe
2022-04-14Publish "Agency"June McEnroe
2022-04-13Swap dates so the difference is always positiveJune McEnroe
2022-04-04Update "Care"June McEnroe
2022-04-03Publish "Care"June McEnroe
2022-03-31Publish "Compassion"June McEnroe
2022-03-24Skip matches with ident chars on either sideJune McEnroe
2022-03-24Add The Invisible Life of Addie LaRueJune McEnroe
2022-03-22Source ~/.profile.local if it existsJune McEnroe
2022-03-18Publish "Addendum 2021"June McEnroe
2022-03-16Remove wcwidth portJune McEnroe
2022-03-16Remove -j4 from ./PlanJune McEnroe
2022-03-15Rewrite Linux install.sh for DebianJune McEnroe
2022-03-15Remove dashJune McEnroeible Life of Addie LaRueJune McEnroe
So good, but so long. Reminded me of The Ten Thousand Doors of January at the beginning, and more of that N. K. Jemisin series about gods later. I like this interacting with gods and becoming something like one sort of thing. God, it took me a whole month (more?) to read and this is only my third book of the year :( I need some more novellas to read, but the other books I have from the library currently are also thick.
2022-03-22Source ~/.profile.local if it existsJune McEnroe
2022-03-18Publish "Addendum 2021"June McEnroe
2022-03-16Remove wcwidth portJune McEnroe
DYLD_FORCE_FLAT_NAMESPACE no longer exists in macOS 12 so this approach doesn't work anymore. Moved to <https://git.causal.agency/jorts/tree/wcwidth> and compiled into <https://git.causal.agency/jorts/tree/ncurses>.
2022-03-16Remove -j4 from ./PlanJune McEnroe
Plan learned to set this automatically!
2022-03-15Rewrite Linux install.sh for DebianJune McEnroe
2022-03-15Remove dashJune McEnroe