Question on the Cloud Scheduler and Time widget behavior:
I have an Opla IoT Kit (w/ MKR Wifi 1010) trying out the Cloud Scheduler example in this article on Arduino IoT Cloud environment. My location is Japan (UTC +9) and set time zone at bottom right in the Thing page to "Asia/Tokyo".
After uploading the sample sketch and looking in the Dashboard, the Time widget shows "Asia/Tokyo" but the value of getLocalTime() seems to be off by 9 hours more from my location time which is UTC +9.
if(ArduinoCloud.connected()){
time_read = ArduinoCloud.getLocalTime();
}
i tried adding two more variables - one to hold getLocalTime() - 32400 seconds, another using getInternalTime() - to compare with this code and the resulting screenshot:
if(ArduinoCloud.connected()){
time_read = ArduinoCloud.getLocalTime();
Serial.print("time_read =");
Serial.println(time_read);
time_read_offset = ArduinoCloud.getLocalTime() - 32400; // -9 hrs in secs
Serial.print("time_read_offset =");
Serial.println(time_read_offset);
sys_time = ArduinoCloud.getInternalTime();
Serial.print("sys_time =");
Serial.println(sys_time);
}
Counter variable is working, meaning the scheduler runs at the set time, but the Time widget (getLocalTime) is displaying the wrong time.
I tried to set Thing time zone to UTC +0 (London) but then the counter variable wasn't working right anymore, maybe because the time variable (in UTC +9) and scheduler (in UTC +0) were off by 9 hours, as in the screenshot here.
My question is: is the article's sample sketch and explanation working correctly as-is and I missed a step, or is the workaround (offset by -9 hrs or use getSystemTime()) correct? Thanks for reading this and appreciate your tip(s)!