Regarding time synchronization

#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

Your code compiles fine for me using the Online IDE.

‘class CloudClass’ has no member named ‘syncTimeDone’

Again I got the same error Sir
Please help me

I’m compiling for a Photon using the 0.6.3 firmware version.

its 0.6.3 or 6.0.3 firmware version

Are you using the Online Build IDE?

Thank you Sir,

My firmware was not upgraded

1 Like

yes, Sir

Now after upgrading my firmware it worked thank you for your kind suggestion.I was worried much

No problem!