TimestampsToReturn
In OPC UA, TimestampsToReturn is a parameter on Read, HistoryRead and CreateMonitoredItems that tells the server which timestamps to include in each DataValue. The four values are Source, Server, Both and Neither. It controls payload size and, more importantly, whether your client receives a process time at all.
The four values
Source returns only SourceTimestamp, Server only ServerTimestamp, Both returns each field the server can supply, and Neither omits both. Neither is legal and is sometimes used for high-rate transfers where the consumer stamps arrival time itself. A server is not obliged to invent a timestamp it does not have: asking for Source when the underlying driver has no device time can return an unset field, or the server clock copied in, depending on the product.
Where it is set, and where it is forgotten
It is a per-request parameter on Read and HistoryRead, and a per-call parameter on CreateMonitoredItems that then applies to every notification from that MonitoredItem for its lifetime. Most SDK convenience wrappers default it to Both or Source and never surface it, which is fine until you need to change it: in several stacks the only way to alter it for an existing MonitoredItem is to delete and recreate the item, because ModifyMonitoredItems does not carry the field.
Practical guidance
Ask for Both during commissioning so you can measure the gap between source and server time and learn what the device actually provides. In production, historise SourceTimestamp where it is genuine and keep ServerTimestamp only if you are monitoring latency. Never ship Neither on data destined for a historian: you lose the ability to distinguish a value that was produced late from one that arrived late, and any replay after a client outage becomes meaningless.
Example
Requesting both timestamps explicitly on a Read in node-opcua
const { TimestampsToReturn, AttributeIds } = require("node-opcua");
const dataValue = await session.read(
{ nodeId: "ns=2;s=Machine1.Counter", attributeId: AttributeIds.Value },
TimestampsToReturn.Both
);
console.log(dataValue.sourceTimestamp, dataValue.serverTimestamp);
Defined in: Part 4 - Services.
Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.