Should 0 total duration be a valid state for a timer?

It's a sentinel value that might take care of some edge cases, but then have to guard against division by 0 when calculating progress ratio (elapsed/total). It's the only sensible default initialization value, but it also doesn't really makes sense conceptually - it's done/triggered before it's even started.

Follow

Obligatory code post after a month:
git.sr.ht/~namark/libsimple_mo
It's not exactly a timer, but can use empty structs to to turn it into one, like this:
git.sr.ht/~namark/truwo/tree/0

I will separate it from the interpolation eventually, maybe in another year or so, though at that point the class would become so small it might just disintegrate into a bunch of free functions.

Example of inconvenience caused by disallowing 0 duration:
git.sr.ht/~namark/sketchbook/c
Very painful, but not hopeless, there is room for improvement.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.