I finally received my Core wohooo, so I can start playing around. I decide using the time feature which is described in the documentation. All things work fine except the described set timezone feature:
the cloud stops compiling. I´am not sure but I want to “set” a time zone, I don´t want to “print” it, you know? Documentation wrong? I can see there a workaround like +x but maybe someone knows how to set the timezone correctly. Btw feature-request: daylight-saving or set the timezone directly in the cloud? Could become quite handy! Anyway awesome thing!
@clyde, good catch on the documentation. The command is simply:
Time.zone(-5); in your case.
I will post a pull request for the change to the documentation. Thanks!
works like a charm! Solved for me thx peekay123
I also have a question about Time-Zones. How does it work with Daylight-Saving Time?
in winter CEST would be +1, and in summer it is +2.
I think a couple of people (including me) are working on daylight savings time. I have code in my NTP-based time library for it and I just need to port it over to the new built-in Time library.
By the way, you will want to call Spark.syncTime() periodically to improve the accuracy. Once a day to once an hour should be good.
Maybe a quick an dirty workaround in the update script?
if date A then time.zone(+/-x);
I’m not sure there is any simple and reliable low RAM daylight saving time code available for worldwide use. I notice several times a year my Linux computers get updates to the various summer time rules around the world. Some countries have no fixed rule - DST dates are decided by statute or dictat every year. The difficulty of implementing that on a Spark Core makes me think (1) the DST status should be supplied by the Spark cloud by you passing it your TZ string when you time.sync [and perhaps it already is] and (2) how nice it would be to have a library or part even of the standard firmware a way to do remote procedure calls to arbitrary programs elsewhere on the web [and perhaps such a mechanism exists or is easy or is planned].