The code is running, but the Particle.timeSyncedLast never actually updates, it always shows the time since the Argon first connected to the WiFi, ie. 25000 after 25 seconds etc. Any thoughts on this one?
I haven’t tried this yet on the Argon (and it could be that Particle.syncTime() has not yet been implemented), but on the Photon I do the Time Sync as follows:
if (Particle.connected()) //Only time sync when Cloud connected otherwise it will block
{
time_t lastSyncTimestamp;
unsigned long lastSync = Particle.timeSyncedLast(lastSyncTimestamp);
if (millis() - lastSync >= ONE_DAY_MILLIS) //More than one day since last time sync
{
unsigned long cur = millis();
Particle.syncTime(); //Request time synchronization from Particle Device Cloud
waitUntil(Particle.syncTimeDone); //Wait until Photon receives time from Particle Device Cloud or connection to Particle Device Cloud is lost
if (Particle.timeSyncedLast() >= cur) //Check if synchronized successfully
{
//do some daily clean up operations here
}
}
}