Timestamp Delay

Hi All,

I’m having an issue where my edge agent is running OK, however the data coming in has a delayed timestamp.

My workflow is very simple, with a 10 minute interval trigger driving the payloads.

I have connected to the agent (Pi) and made sure the timezone is set correctly, and enabled network time sync.

This appeared to for work for a very short time, but the delayed behaviour has started again.

You can see in the screenshot:
The current time.
The time of the payloads (interpreted time from ms conversion)
The fact that they are coming in every 10 minutes regularly. Just always delayed.

They are two different devices.
Same behaviour.
Slightly different delay.

@ChrisGM,

Hello!

Within your Edge Workflows, what do you have at the “Time” field?

Do you mean on the debug for an incoming payload?

Sorry, could have totally be more specific there!

I mean within the Device State Node thats reporting state.

“Use the time of the current payload”

I have just captured a debug message.
The time is ‘in the past’.
If you could send a link, i’ll send you an un-redacted screenshot of the payload debug.

@ChrisGM,

Thank you! I’m not quite sure why you’re experiencing any delay. From the looks of your screenshots, it seems that both devices reported state every 10 mins. Could you give me a little more info on what you’re expecting?

It’s not a physical delay. It’s just that the ‘time’ on the payload is 20 or 25 minutes in the past!
Therefore even though I’m getting readings every 10 minutes, the database appears to not be recently updated, as the ‘latest reading’ is always 20 minutes old.

I think a screenshot might explain a little better!

To add another clue:

If the workflow timer node triggers the workflow, the time on the payload is old.

if I use a ‘poll button’ to trigger the workflow, the time on the payload is correct.

@ChrisGM,

Would you be able send me a screenshot to support the behavior your seeing?

I would love to see a screenshot that shows your current time and an old payload time using the Timer Node.

Sure, can you please send me a PM?
Will save me time editing!

Here is the redacted screenshot

@ChrisGM,

That time is coming from the system time of your Edge Device. When you run the Linux command date on your edge device, do you see it 20 mins behind? Like so:

image

Time appears correctly (in sync with current real time)

One more test is to verify the date inside the Edge Agent container itself is not delayed. You can do that by running the following command:

docker exec <container-id> date

The time appears to be correct.

Ran at 11:51am
Time shown is 10:51 (UTC)

We believe we have identified the issue. The underlying cause is a delay between when the Edge Agent initially launches and when NTP syncs the system time. Timers initialize their own time when the agent launches. Changes to system time do not affect them. This is because if the system time changes, the timer can end up being very confused.

There are a few fixes:

  1. Restart the Docker container. This should re-initialize the container with the most up-to-date time.
  2. When reporting Device state, use the Use current time option, this will report state using the current system time.
  3. Use a Date/Time Node at the beginning of the workflow to set the time payload path to the current system time.

@Brandon_Cannaday @anaptfox

Thank you both for your support.

Option 3 - Adding the Time/Date node is the ideal solution, tested as working.

I am going to do some archive tests to make sure ‘loss of comms’ events are covered, but if you don’t hear anything you can assume these also worked!

1 Like

Awesome. This is the fun part of IoT. These challenges turn into cool projects and I’m exited to see yours come to life!