Re: Because dates in calendar are closer than they appear
Rick Moen <rick-IyCrq+X4Fdq2oZ/[email protected]>
| Newsgroups | gmane.org.user-groups.linux.svlug |
|---|---|
| Organization | If you lived here, you'd be $HOME already. |
| Message-ID | <[email protected]> |
Quoting Ivan Sergio Borgonovo ([email protected]): > This is way too verbose but I think it is going to be a bit more > accurate, anyway I won't bet on it since dates are tricky and I just > finished to write it and here it is 3:00am Very nice, after swapping d1 and d2 in the subtraction step. (If I could script that well around 3am, I'd certainly be proud.) Here where it's almost midnight locally, ./daysuntil 2016-12-15 returns '0', which arguably is arithmetically correct -- as long as you understand that zero in this case is a proxy for the concept of 'tomorrow'. This is one of those cases where a computerist in good standing would argue that the code is right, and that humans resisting the idea of 'zero days from now' being equivalent to 'tomorrow' are broken. ;-> To be maximally human-friendly, I suppose one would have to write into the date processing the notion that any fraction of the present day prior to midnight is a 'day', and that any portion of the future date after midnight is also a 'day'. [1] Albeit I for one welcome our simple algorithm overlords. -- Cheers, "I don't need to test my programs. Rick Moen I have an error-correcting modem." rick-IyCrq+X4Fdq2oZ/[email protected] -- Om I. Baud McQ! (4x80) https://thc.org/root/phun/unmaintain.html