Hi,
Build on Photon, using Device OS 1.0.1, via IDE
I’ve been working on a custom clock, for a while, and its been a hard slog for a while, mostly to do with issues around keeping the device synced over a few days. However my issue at the moment is testing Daylight savings calculations, and I need to test how it handles my code.
I’m at the stage of testing and therefore want to intentionally set it to given time stamps, so I can check how it handle powering on and off at different times of the year and passing though the change of daylight savings…
So I am having trouble getting it to take a specific time.
I’ve written an extremley simple snippet of code to set the device to 03/30/2019 @ 11:55pm (UTC), which is 5min before midnight close to the up and comeing daylight saving event here in the new year:
//Time.setTime(1553990155);
void setup() {
Time.setTime(1553990155);
}
void loop() {
Serial.println("Date:- " + Time.timeStr());
delay(1000);
}
So it prints out the set time I want for about 5 seconds and then jumps to the real world time now.
The only way I can see to over come this is to change my SYSTEM_MODE, which is with the above code default automatic… I think… And that means rigging up an interupt button to be able switch it back to automatic to be able to OTA update my code everytime I tweek it…
So my question is… Is there an easyier way to do this? IE stop the Device OS running off and updating the device time, after I’ve preset it, without loosing other functions.
Thanks
Liam