Time.zone not working

The following code

void setup() {
    Serial.begin(9600);
}

void loop() {
    Time.zone(-1);
    unsigned char const DEC_BASE = static_cast<unsigned char>(DEC);
    Serial.println( "tn: " + String(Time.hour(),DEC_BASE) );
    Time.zone(5);
    Serial.println( "tn: " + String(Time.hour(),DEC_BASE) );
    Serial.println("");
    delay(2000);
};

produces the following output

Opening serial monitor for com port: "COM4"        

tn: 14                                             
tn: 14                                             
                                                   
tn: 14                                             
tn: 14                                             
                                                   
tn: 14                                             
tn: 14  

Why isn’t the hour changing? Thanks.

1 Like

Hi @OrangeOctober

You are right–that does not seem to be working right. I opened an issue on github for this here

Here’s a work-around: call Spark.syncTime(); when you change time zones. That worked for me but if you call it too frequently, it seems to knock the cloud connection down. The cloud resets it self and carries on but you get a cyan flash periodically in between breathing cyan.

1 Like