This refactors the internals of the Timer, such that it's impossible for different fields to contain conflicting information. This is done by factoring out an ActiveAttempt struct that only exists when there is an active attempt. Additionally inside it differentiates between the attempt having ended or not. The not ended state has a split index and an optional pause time, whereas the ended state has the date time of when the attempt ended.
This does not yet touch the public API of the Timer. Factoring out the notion of an active attempt and making sure invalid states are unrepresentable is done so we can soon explore the possibility of storing an active attempt in the splits file.
This refactors the internals of the
Timer
, such that it's impossible for different fields to contain conflicting information. This is done by factoring out anActiveAttempt
struct that only exists when there is an active attempt. Additionally inside it differentiates between the attempt having ended or not. The not ended state has a split index and an optional pause time, whereas the ended state has the date time of when the attempt ended.This does not yet touch the public API of the
Timer
. Factoring out the notion of an active attempt and making sure invalid states are unrepresentable is done so we can soon explore the possibility of storing an active attempt in the splits file.cc #266 #156