Coding 2026-04-19
I was working on other stuff today, and spacing out hard, but right now I've got some problems around the calendar stuff that I want to work out.
Suppose, for the sake of argument, that we're considering a system that implements calendars for both Earth and Mars, as well as conversions between them. Suppose furthermore that the ultimate basis of these systems is day count from a particular epoch, and sol count from a particular epoch, not necessarily the same epoch, respectively. Let's call these RD and RDM, on the assumption that Latin word order is free enough that I can just put adjectives anywere. Now, RD and RDM are both going to be represented with integers, and have associated deltas which can be multiplied, divided, have a remainder taken, etc. Suppose we want to have a system for describing weeks on Earth, as well as weeks on Mars. The operations are going to be generally identical, with the major distinction being the "flavor" of integer that the require.
Going for an Earth week first, we need a list of days, and a means of converting from an RD value to a given day. This is accomplished by choosing a particular RD value, and giving the day of the week on that date.
Correspondingly, for Mars, we need a list of sols, an RDM value, and the sol on that date.
The operations we require on RD/RDM are subtraction to establish a delta, and shifting by a delta. Now, because subtracting an RDM from an RD, or vice versa, is meaningless, then that means an explicit delta operation is required to enforce correctness. Be right back, writing that. Okay, that's written and added. Now to figure out how to handle other things...
Honestly, I think it might make more sense at this point to create explicit wrappers for RD/RDM and deltas. (Currently, I've got a newtype for RD.) There'd be addition and subtraction for RD, and the deltas would have addition, subtraction, multiplication, division (with floor?), mod, and probably more things that I'm not thinking of. My intuition tells me that I should sleep on this before making any code changes. (One question to consider is, what exactly are the values indicating days of the week, under this system?) I'm going to wind down and try to fix my breathing...
Good night.