Particle Monitor --time (where?)

I have been testing out the Particle monitor command. I came across --time.

particle monitor <My device id> analogvalue 5000 --time

2016-06-20T12:16:36+02:00, 408
2016-06-20T12:16:42+02:00, 408
2016-06-20T12:16:48+02:00, 407
2016-06-20T12:16:56+02:00, 408

This appears to be the current time that it was read. But which time? The particle device or my PC?

I am thinking time zones here. It doesn’t appear to be GMT. I checked the documentation no help there Particle monitor

I am just curious.

Linda

I’d say it’s the computer time since I’m unaware of the Photon sending the time if not explicitly instructed to.
On the other hand there would be a third (less likely) option - the cloud time.

And since you seem to be in Denmark the +02:00 would fit your time zone - GMT+1 +1h DST.
You could also check if it was the devices time by setting Time.zone(somethingElseThanPlus2) :wink:

yeah my guess was it was computer time as well. I suppose i could spin up a VM in a different timezone and we can test it :slight_smile:

I’d see reflashing the Photon as the easier way :wink:
And the cloud time woud be UTC (+00:00 or Z)

Ohh didn't know you can do that. Awesome idea.

If you don’t set Time.zone() in your code it will be assumed as +0 (=UTC)

See now I would assume it would get the time from the WiFi. BTW I don't need this i just suffer from the disease of rampant curiosity.

I am waiting for more stuff to come in the mail so in the mean time i have to do with it what I can.

1 Like

Nope, the RTC is initially synced to UTC when first connected to the cloud (or later when it drifts by you via Particle.syncTime())

It’s up to you to set the zone and also care for DST offsets (via Time.zone() too)

Code:

Time.zone(-6);
currenttime = Time.now();
Particle.variable("currenttime", &currenttime, STRING);

OutPut:

2016-06-20T15:00:13+02:00, Mon Jun 20 06:59:57 2016
2016-06-20T15:00:19+02:00, Mon Jun 20 07:00:07 2016
2016-06-20T15:00:27+02:00, Mon Jun 20 07:00:18 2016

Anwser: --Time is the local time on the machine running the request.

3 Likes