Coding 2026-05-07

By Max Woerner Chase

My focus switched back to the calendar stuff today. I believe I've got a solid interface for different units, but I'm not sure how best to implement it.

Basically, I have a wrapper class that combines a "duration" of some numerical type, with a "unit", and provides facilities for several kinds of conversions, by passing in different units. The idea is that it kind of path-finds a string of unit conversions to ultimately convert from the original unit to the target unit. However, I haven't come up with an implementation of this that strikes me as elegant. Every unit class is related to a "parent" class, and the only possible way to figure out what chain to build is to traverse the chain from both unit classes until some common class is reached.

...

All right, I found something that seems to work, at least for the precise conversions. Need to figure out how to work with the approximate conversions. For now, going to wind down.

Good night.