I’ve successfully gotten the Sparktime library to run on my device. However, I would like to automatically set the DST (or GMT offset) for my location. What would be the easiest way to do this so I don’t have to manually adjust things twice a year? Also, is there an easy way to set this as 24-hour time? Here is my current code:
With my SparkTime NTP library you don’t need to have your own DST function, it is built into the library.
In setup you can call rtc.setUseDST(true); and you can add rtc.setUseEuroDSTRule(true); if you are in Europe instead of the US, but at GMT-6 it looks like you are in the US.
For testing, currentTime is in seconds so you can just figure out how many seconds you want to advance or retard the clock by to test and add or subtract that from currentTime. So for instance, US DST ends on 11/1 at 2:00 AM–that is around three weeks plus one day and three hours from the time I am writing this, so the testing offset would be:
I have not worked on this library in some time and many of its features were superseded by things that Particle added, so I would say it is not likely to be updated.
But you do have me curious: does Australia have different rules for DST?