Time difference between cloud and photon

Hello everyone,

I have an issue with time being synced to the cloud. I’ve got a simple program to control some relays based on what hour of the day (in 24 hour format) but the photon seems to be on a different time zone setting.

As an example, when I publish the time via the following code:

Particle.publish(“Time is now:”, Time.timeStr());

I get a response that it is “2:48” when in fact my local time is 6:48pm
I have tried calling Time.syncTime() to sync to the cloud time, but it doesn’t fix the issue.
Everything on my cloud console displays my correct local time, but is there a way to adjust it on the cloud side - I’m thinking there is a user preference on the cloud console for time zone but I cannot find it?

I also tried using Time.Set to manually set it to the current time, but it does not seem to stick.

Finally, I have tried resetting the power to the board, power cycled, etc.

I have already adjusted my program to compensate for this issue, but after playing around with arduino’s and RTC’s I was ready for something a little more…robust, so I’m hoping to find a solution that works.

Thanks in advance!

You need to set the time zone (offset in hours from GMT) for you location using Time.zone(). Do this before calling any of the other Time functions.

Time.zone(-8); // for Pacific Standard Time, for instance 

That worked perfectly, and funnily enough I was about to try that function just to see if it would work!

Thanks for your help, Ric.