IMD SolutionComputing LibraryShop main store

Explainer

Why Historian replaces a client-set ReceivedTime

Edge computing and IIoT Published 4 min read

Short answer

Yes, it is expected: Historian assigns ReceivedTime itself, as a UTC receipt stamp, when the server accepts the event, and no option preserves a client value. EventTime is the field your application owns — set it to the occurrence time, drop the ReceivedTime assignment, and carry any third timestamp as a custom property.

On this page
  1. What each timestamp field owns
  2. Why nothing preserves a client-supplied value
  3. The fix in the event construction
  4. A worked example with numbers
  5. Proving the round trip
  6. When a third timestamp must survive
  7. Questions asked

Yes, this is expected, and no setting changes it. AVEVA Historian assigns ReceivedTime itself, at the server, at the moment the event arrives; the Events page of the AVEVA Historian documentation defines the field as a DateTime in UTC indicating when the Historian server received the event. The field your application owns is EventTime. Set it to the time the event occurred, delete the ReceivedTime assignment from the construction, and carry any third business timestamp as a custom property. Nothing failed in the submission: the code assigned a field the server does not take from clients.

What each timestamp field owns #

A stored event carries two time fields with different owners, and every display or query shows one of them whether it says so or not.

Field Set by Meaning on the stored event
EventTime Your application, at construction When the event occurred
ReceivedTime Historian server, at ingestion UTC time the server received the event
Custom properties via AddProperty Your application Named payload values, including any extra timestamp you define

The same documentation lists IsAlarm as a Boolean field of the event in its own right, which matters below. The working rule is simple: bind an occurrence column to EventTime, bind a receipt column to ReceivedTime, and never let a viewer column labeled just Time decide for you.

Why nothing preserves a client-supplied value #

The only component that knows when the event reached the server is the server, and that is exactly what ReceivedTime records. The ingestion step writes the field itself, so a value sitting in the client-side object is dead on arrival: there is no property, option or server-side toggle that keeps it. A successful return from AddStreamedValue means the event was stored; it has never meant that a supplied receipt time was honored. The mirror case on collected tag data — where a historian shows current time for backdated PLC data — is a collection-side problem with its own cause and fix, not an event API behavior.

The fix in the event construction #

HistorianEvent historianEvent = new HistorianEvent
{
    ID = Guid.NewGuid(),
    EventTime = DateTime.Now,
    Type = "TestEventType"
};

DateTime.Now is the right source only when the event is genuinely defined at submission, such as an application-generated message. For queued, buffered or replayed events, assign the occurrence time you retained with the event; a fresh clock reading stamps when the sender ran, not when the condition happened. Deleting the ReceivedTime line changes nothing at the server — it removes an expectation the server never promised to meet.

Two unrelated defects sit in the same sample. A stray General token before a Console.WriteLine call stops the build, which is a compilation problem, not a timestamp problem. And the first failure message names Message while the property being added is RandomName; make each log line name the property it actually attempted, or troubleshooting follows the wrong identifier.

One check while you are in there: because IsAlarm is documented as a Boolean field of the stored event, verify in your installed API documentation whether that AddProperty call is needed at all, or whether the field is set directly on the event object.

A worked example with numbers #

Illustrative inputs, site running at UTC-5, event built by a buffered sender:

  • Occurrence time assigned to EventTime: 14:32:10 local.
  • Clock when AddStreamedValue runs: 14:34:02 local.
  • Ingestion latency: 14:34:02 - 14:32:10 = 1 min 52 s = 112 s.
  • Stored ReceivedTime: 14:34:02 + 05:00:00 = 19:34:02 UTC.
Check on retrieval Expected Read back Verdict
EventTime preserved 14:32:10 local 14:32:10 local matches
ReceivedTime server-set 19:34:02 UTC 19:34:02 UTC matches
Latency between them 19:34:02 - 19:32:10 = 112 s 112 s plausible for a buffered sender

The decisions fall out of the arithmetic. A 112 s spread between the two fields is queue and transport time, not corruption; a five-hour spread is UTC versus local representation, not ingestion delay. Alarm and event queries can express time as UTC (EventTimeUtc) or as local time at the server's location, so put both fields into one representation before comparing them.

Proving the round trip #

  1. Build one test event whose EventTime is deliberately minutes earlier than submission, using the retained occurrence time, with a fresh Guid.NewGuid() for its ID.
  2. Log the ID, the submitted EventTime, each AddProperty result and the AddStreamedValue result.
  3. Retrieve the event by that ID, not by a time window, so you compare the event you actually sent.
  4. Compare the stored EventTime with the submitted value in a single time representation.
  5. Read ReceivedTime as the server's receipt stamp and check the latency arithmetic against your submission log.

Keep property failures separate from timestamp questions: a missing custom property is a payload problem with its own error?.ErrorDescription, and a wrong-looking time is a presentation problem. Decide explicitly whether a failed required property should abort the submission instead of storing a partially populated event.

When a third timestamp must survive #

If a report needs a time that is neither the occurrence nor the server receipt — the moment your application accepted an event for forwarding, for example — store it as a custom property under its own name through AddProperty, and confirm against your installed documentation which value types the property calls accept. Keep the time zone explicit inside the property value. Keep the sender's clock synchronized with the Historian server's clock, because a difference between the two masquerades exactly like ingestion delay.

Questions asked

Why is the retrieved ReceivedTime also five hours off?

ReceivedTime is stored as UTC. At a site running UTC minus five, a receipt at 14:34:02 local is stored as 19:34:02, the same instant on another scale. Convert one side before comparing, and remember that alarm and event queries expose UTC through EventTimeUtc while other views may show the server's local time.

Should EventTime be DateTime.Now at the sender?

Only when the event is defined at that moment, such as an application-generated message. For queued, buffered or replayed events, DateTime.Now records submission time, and every retry moves it later. Carry the occurrence time with the queued item and assign that value when the event is constructed.

Where should a report-specific timestamp go?

In a custom property under its own name, added with AddProperty, never in ReceivedTime. A forwarding-acceptance time is a typical case. Check the installed API documentation for the value types property calls accept, then retrieve a test event and confirm the property value survives the round trip.

A custom property failed to add. Is that related to the timestamp being overwritten?

No. Property calls and timestamp ownership are independent. Read the return value of each AddProperty and its error description for the property that actually failed; in the sample, the first failure message names Message while the property being added is RandomName. Fix the payload error separately from any timestamp display question.

Does the same overwrite affect collected tag values?

Events and collected samples take different paths into the historian. On collected tag data the comparable symptom is backdated PLC values coming back stamped with the current time, which is a collection-side question with its own cause. The event API keeps its own rule: the application owns EventTime, the server owns ReceivedTime.

Keep reading

  • Troubleshooting

    Why historian shows current time for backdated PLC data

    The historian is not replacing PLC timestamps with server time. The streamed write path enforces time order: a value that arrives out of order is restamped just after the last accepted value and flagged in quality detail, while backdated values that arrive in order keep their old dates — which is why clients show current time and History Blocks still show 2012. Disable Auto-Summary to stop the Replication service crashes, then move the affected tags to a non-streamed write path.

    Edge computing and IIoT

  • How-to

    Convert Ignition historian CSV timestamps in Excel

    The 13-digit column is epoch milliseconds counted from 1970-01-01 00:00:00 UTC: convert it with =A2/86400000+DATE(1970,1,1) and a custom format of yyyy-mm-dd hh:mm:ss.000. For a data-match audit, script an as-stored tag history query instead of exporting from the chart, and compare both sides in UTC.

    Edge computing and IIoT

  • How-to

    Get ETAP RTU data into AVEVA Historian the supported way

    Keep the ETAP acquisition path and feed AVEVA Historian from ETAP's OPC UA publication for live values, with a documented historical import for the SQLDB and MongoDB records. The gateway zeros carry OPC DA quality 0x0040, Uncertain, from a second RTU session the reported single-client limit leaves unavailable, so they are acquisition failures, not measurements.

    Edge computing and IIoT