Time Picker Widget 2 Hr time error

Hi. I did the Arduino IoT scheduler tutorial. All works fine but for some reason the Time picker is out by 2 hours. The scheduler seems to be on time but not the time picker. I set my time zone for Africa/Johannesburg but if I calculate the time the picker shows. It seems to be the time in Dubai.

Im using a Arduino 33 IoT with a USB cable and I work on the cloud.

Is there away to correct this error? Maybe writing some code or set my ting up in a certain way?

Hi. I solved the challenge. The time that you get from the cloud with the instruction ArduinoCloud.getLocalTime() is in epoch. So I just subtracted 7200 as 1 hour is 3600 seconds. This gave me the correct time for South Africa. So my line of code looked like this

time_read = ArduinoCloud.getLocalTime() - 7200;

I hope this help somebody ells with this instruction and time picker.

Hi @flowgrow,
what you are describing here is a bit strange and should not happen: after you have correctly configured your thing timezone, ArduinoCloud.getLocalTime() should return your local time and ArduinoCloud.getInternalTime() the UTC time. No additional offset shoud be required in order to read the correct time.

I'm starting to suspect that in some conditions the internalTime has alreay some offset applied.

Could you please add avariable to your sketch and report me its value ?

utc_time = ArduinoCloud.getInternalTime();

Don't forget to write also the time you run the test so we can compare it to localTime and internalTime from the library.

Thanks!

Hi Pennam,

I added this to my code and it shows the correct time without me having to subtract 7200 from it.

So your instruction gives me the correct time for my time zone. Thankyou very much

HI @flowgrow ,
this confirms my suspect that the internal time has already an offset ...
Assuming you are doing your test now:

Time in cape town is 11:04
ArduinoCloud.getLocalTime() should return 11:04
ArduinoCloud.getInternalTime should return 9:04

Instead you are getting
ArduinoCloud.getLocalTime() returns 13:04
ArduinoCloud.getInternalTime returns 11:04

are you willing to help me understand why?

Thanks

Hi Pennam,

I can't say for sure why there is a time difference.

But I have attached my code and what the dashboard looks like

MKR_1400_Sim_Test_feb07a.zip (7.56 KB)

Thanks @flowgrow the sketch looks ok, i suspect the timeshift comes from the getRemoteTime() function in the IoTlibrary.

Are you using a NANO33IoT or a MKRGSM1400 ?

it would be helpful for me if you can comment this lines in the IoTLibrary, upload the sketch again and check if the timeshift is fixed.

Thanks

I used the Nano IoT 33.

I will do and let you know

@flowgrow we just released a couple of bug fixes on the Time Picker, can you check it now?

Hi.

I looked at it and it seems not to work.

But that being said it can be that my code is messed up.

I have added my code for you to have alook at.

FD Time picker
Flood_Drain_V1_feb27a.zip (13.8 KB)

Please use

if (ArduinoCloud.connected()) {
   cloudTime = ArduinoCloud.getLocalTime();
}

Thanks. I changed my code and it worked perfectly.

I appreciate you assistance and patience.