I'm putting this in a separate branch and doing a pull request in case you have a compelling argument for using class variables instead of just instance variables for Labtime. These modifications work in all the notebooks which use labtime and all the tests pass.
If you think it is important to have only one set of times, it is also possible to modify the interface in such a way that doing Labtime() will always give you a reference to the tclab.labtime.labtime instance, but I can think of more cases where it may be useful to have different Labtime instances than where we need all instances to be synced. Since there is a simple way of getting the "standard" labtime instance (from tclab import labtime), I think this just makes everything simpler.
I've also slipped a lastsleep property which is useful when seeing how much time clock is spending in sleep as a first step toward allowing better feedback about how close we are to losing sync.
I'm putting this in a separate branch and doing a pull request in case you have a compelling argument for using class variables instead of just instance variables for
Labtime
. These modifications work in all the notebooks which use labtime and all the tests pass.If you think it is important to have only one set of times, it is also possible to modify the interface in such a way that doing
Labtime()
will always give you a reference to thetclab.labtime.labtime
instance, but I can think of more cases where it may be useful to have differentLabtime
instances than where we need all instances to be synced. Since there is a simple way of getting the "standard" labtime instance (from tclab import labtime
), I think this just makes everything simpler.I've also slipped a
lastsleep
property which is useful when seeing how much timeclock
is spending insleep
as a first step toward allowing better feedback about how close we are to losing sync.