@Gordon, is it possible write to the getTime() value holder? If so, the Clock object could get a method - say: push() - that would write the 'absolute' - actually any - time back to that holder and the holder now holds the 'unix birth date' or any offset date, for example AD. On a reset it is easy to detect - by the app code - if the time has been set or not - and then create a clock object with a pop()... or a-like. If the getTime() value cannot be written back, storing a 'difference' of value 'somewhere' where it survives a reset can be used to restore the 'absolute' time again. And again, it is easy to the app to detect whether the 'difference' has been set or not. Later solution would be: create a meaningful value with two meaningless values (offset of offset).
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
@Gordon, is it possible write to the getTime() value holder? If so, the Clock object could get a method - say: push() - that would write the 'absolute' - actually any - time back to that holder and the holder now holds the 'unix birth date' or any offset date, for example AD. On a reset it is easy to detect - by the app code - if the time has been set or not - and then create a clock object with a pop()... or a-like. If the getTime() value cannot be written back, storing a 'difference' of value 'somewhere' where it survives a reset can be used to restore the 'absolute' time again. And again, it is easy to the app to detect whether the 'difference' has been set or not. Later solution would be: create a meaningful value with two meaningless values (offset of offset).