Cloud functions
Particle.syncTimePending()
Since 0.6.1:
Returns true
if there a syncTime()
request currently pending. Returns false
when there is no syncTime()
request pending or there is no active connection to Particle Device Cloud.
// SYNTAX
Particle.syncTimePending();
// EXAMPLE
SerialLogHandler logHandler;
void loop()
{
// Request time synchronization from the Particle Device Cloud
Particle.syncTime();
// Wait until the device receives time from Particle Device Cloud (or connection to Particle Device Cloud is lost)
while(Particle.syncTimePending())
{
//
// Do something else
//
Particle.process();
}
// Print current time
Log.info("Current time: %s", Time.timeStr().c_str());
}
See also Particle.timeSyncedLast()
and Time.isValid()
.