Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
DataValue getServerTimestamp() and getSourceTimestamp() methods
November 20, 2023
20:08, EET
Avatar
Jeremy Morgan
Member
Members
Forum Posts: 15
Member Since:
November 6, 2019
sp_UserOfflineSmall Offline

Hi,

Please can someone clarify the differences in behaviour of the DataValue.getServerTimestamp() and DataValuegetSourceTimestamp() methods?

On the application server running the Prosys client, I am subscribed to OPC tags and am using the MonitoredDataItemListener.onDataChange() callback and I am using the DataValue.getServerTimestamp() method to extract the event timestamp.

I am getting some events with a timestamp a few seconds ahead of the application server’s timestamp even though the application server is synchronised to an NTP server, and apparently so is the OPC UA server.

Is there any way that the getServerTimestamp() could be in the future or past compared to the OPC server’s clock?

November 21, 2023
12:03, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 340
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

getSourceTimestamp() returns the Source Timestamp that has been provided by the source of the data. getServerTimestamp() returns the Server Timestamp that has been provided by the Server when the DataValue was read. For more information on DataValues and their timestamps, see https://reference.opcfoundation.org/Core/Part4/v105/docs/7.11

You mentioned “application server” and “OPC UA server” separately. Are these two different Servers or are they the same OPC UA Server?

Has the OPC UA Server been developed with Prosys OPC UA SDK for Java?

In general, the timestamp returned by calling getServerTimestamp() is the timestamp provided by Server when it gave the DataValue to your Client via reading or monitored items. If there is an error in the timestamp, e.g. it would seem to be in future, then that error was caused by the Server when sending the DataValue.

November 21, 2023
12:15, EET
Avatar
Jeremy Morgan
Member
Members
Forum Posts: 15
Member Since:
November 6, 2019
sp_UserOfflineSmall Offline

Hi,

Thanks for your reply.

The ‘application server’ is where our application is running. This is a Linux box with our application (OPC UA client) using the OPC UA SDK for Java. The OPC UA Server itself is on another machine – a Windows Server. It is a Kepware OPC server.

So, it seems that the getServerTimestamp(), which I am using, should be the safest way of getting a timestamp, assuming that the OPC UA Server host clock is correct. I will get them to double check that.

November 21, 2023
12:56, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 340
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

It depends on what you plan to do with the timestamp. The Server Timestamp effectively tells when the DataValue was provided according to the Server. The Source Timestamp tells when the value was last modified on the Server either by the Server itself or by some Client.

For example, if you’re reading a Value that hasn’t changed multiple times, each of the read DataValues would have a different Server Timestamp but the same Source Timestamp (assuming the Server supports Source Timestamps properly). If it is sufficient for you to know when the value was read, then you can use Server Timestamp. But if you would need to know when the value was changed to its current value, you should use Source Timestamp instead.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 86

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 732

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1508

Posts: 6396

Newest Members:

elainesever, powhephenry, mamiecaldwell5, Lamasom, scsneed, berrybulcock, icerdraizomma, athenasummy5, vtaletbhcx, HaroldaDob

Moderators: Jouni Aro: 1019, Pyry: 1, Petri: 0, Bjarne Boström: 1016, Jimmy Ni: 26, Matti Siponen: 340, Lusetti: 0

Administrators: admin: 1