Login  •  Register


Problem with History Trend View

Questions regarding the use of the UaExpert.

Problem with History Trend View

Postby Bertuz » 26 Aug 2019, 12:46

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
Bertuz
Jr. Member
Jr. Member
 
Posts: 3
Joined: 25 Jan 2019, 08:55

Re: Problem with History Trend View

Postby Support Team » 08 Jan 2020, 18:35

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
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2445
Joined: 18 Mar 2011, 15:09


Return to UaExpert

Who is online

Users browsing this forum: No registered users and 0 guests

cron