Problem with time UTC vs Local

I do not seem to be able to get the time correct. I am based in South Africa so we are at UTC + 2.
The facts are as follows:

  1. The system/server.log time is displayed correctly.
  2. I am using the value of time() as input to date() and then using the members of the array using the same code to display the time on both sides.
    t1 = date(time(), "l"); t2 = date(time(), "u");

The problems are as follows:
#1 The exact 2hrs of UTC missing.
#2 sometimes a gap of 1.5 to 2 minutes between device and agent.

2014-05-04 20:37:56 UTC+2: [Agent] ==> Agent RESTARTED: 2014/05/04 18h37.56
2014-05-04 20:38:08 UTC+2: [Device] ==> Device Restart @ 2014/05/04 18h39.56
2014-05-04 20:38:08 UTC+2: [Device] ==> Device Restart @ 2014/05/04 18h39.56

Any suggestions of where to look?


The time in your logs viewed in the IDE is based on your browser time. The imp has no knowledge of this - the imp and agent see time in UTC only.

As for the 2 minute skew on your device, how long as it been running since power up (or sleep/wake)? We resync the time on connect but it can drift after that. A future server update will resync much more often.

Can you force a sync in the code?

@hugo in this case the imp had been running for a very short time, the server.log output shows the output of the time test code immediately after a restart.

As far as the ‘l’ vs ‘u’ parameter is concerned, what you are saying is that it is ignored ie not implemented?

ammaree, are you using a Windows computer? is it synced to ?

I saw a small discrepancy last night of between 1 and 2 minutes and I tried changing time servers and it change to be closer to the imp server time. however, today I don’t see such a difference.

Maybe the Windows OS does not synchronize very often…?

@ammaree correct, UTC is the only time the imp or agent knows about. We have timezone guesstimation (based on geoIP of the imp’s IP address) on the roadmap but it’s not available yet.

@back_ache: we will be rolling out continuous time sync (at least to +/-1s) in the fairly near future. It’s a server-side feature so the impOS doesn’t need to change.