Problem with History Trend View

Questions regarding the use of the UaExpert.

Moderator: uaexpert

Post Reply
Bertuz
Jr. Member
Jr. Member
Posts: 3
Joined: 25 Jan 2019, 08:55

Problem with History Trend View

Post by Bertuz »

I'm using the GettingStarted_VS2015.Lesson07_VS2015 project from the .Net Boundle to test the "history trend view".
I noticed that the "DateTime.UtcNow" is used in the C# code.
If I replace it with "DateTime.Now" the "History Trend View" stops working properly especially in the "CyclicUpdate" mode.
The points where I replaced "UtcNow" with "Now" are:
- ServerGettingStarted\Lesson07\Lesson7aNodeManager.cs(236): dv = new DataValue(new Variant(value, null), DateTime.UtcNow);
- ServerGettingStarted\Lesson07\Lesson7bNodeManager.cs(311): dv = new DataValue(new Variant(value, null), DateTime.UtcNow);
- ServerGettingStarted\Lesson07\System\UnderlyingSystem.cs(167): property.History.Insert(new Variant(value, null), StatusCodes.Good, DateTime.UtcNow);
- ServerGettingStarted\Lesson07\System\UnderlyingSystem.cs(400): bp.HistoryConfiguration.StartOfArchive = bp.HistoryConfiguration.StartOfOnlineArchive = DateTime.UtcNow;
- ServerGettingStarted\Lesson07\System\UnderlyingSystem.cs(505): history.Insert(new Variant(value, null), StatusCodes.Good, DateTime.UtcNow);
My PC's time zone is "Rome".
It would seem a bug.
Thanks in advance

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Problem with History Trend View

Post by Support Team »

Hello,

in OPC UA specification the time is always defined as UTC. Hence your server is not allowed to send any local time over the network, everything must be UTC. The changes you made to the code are WRONG.

The receiver (clientside) must decide if and then convert to whatever local time it preferres for displaying. However this is the choice of the client (the server has no choice, must always provide UTC time stamp).
Best regards
Unified Automation Support Team

Post Reply