#define ONE_DAY_MILLIS (24 * 60 * 60 * 1000)
time_t watch;
String mytime;
void setup() {
Serial.begin(9600);
}
void loop() {
unsigned long lastSync = millis();
Time.zone(+5.30);
watch=Time.now();
Time.format(watch, TIME_FORMAT_DEFAULT);
if (millis() - lastSync > ONE_DAY_MILLIS) {
// Request time synchronization from the Particle Cloud
Particle.syncTime();
Serial.println(Time.timeStr());
lastSync = millis();
}
if(Particle.syncTimeDone()==true)
{
Serial.println("Time synchronized");
}
if(Particle.syncTimeDone()==false)
{
Serial.println("Time not synchronized");
}
mytime=Time.timeStr();
/*if(Time.isValid()==true)
{
Serial.print("Time valid status = Valid");
Serial.println();
Serial.println("=========================================");
}*/
Serial.print("Time in Seconds =");
Serial.print(watch);
Serial.println();
Serial.println("=========================================");
Serial.print("Formatted Time =");
Serial.print(mytime);
Serial.println();
Time.format(Time.now(), "Now it's %I:%M%p.");
delay(5000);
}
The above code which I have written displays Current time but I feel somewhere it is not synchronized so I am using
"Particle.syncTimeDone()" function to check for synchronization completion.But when I run this code I am getting an error showing that
"‘class CloudClass’ has no member named ‘syncTimeDone’ " So please help me in solving this issue