Left for archival purposes.

User avatar
By scargill
#4226 You can READ the system timer in microseconds - but you can't (I don't think) WRITE to it - could you add this - given a Linux timestamp from a web server it would be great to be able to set the time... rather than reading it every time... ok, one could read the number of microseconds and do a calcullation but it's not the same.

Also what kind of number is in that clock--- ie how long before it will overflow - if we know exactly when it overflows we can work around it...
User avatar
By GeoNomad
#4374
scargill wrote:Also what kind of number is in that clock--- ie how long before it will overflow - if we know exactly when it overflows we can work around it...


It overflows in 35 minutes. It is a signed 32 bit integer.

So, it is of no use as a long term timer.

In which case, you may as well keep your own version of time() with an appropriate offset that can be adjusted.

This does require firing a timer at least once every 30 minutes to update the "clock". That has become feasible with 7 timers.

I haven't checked, but have been meaning to - do the timers wake up Lua from deep sleep? Do GPIO interrupts?

Peter