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
Changing the time and the timezone of the OPC UA server at runtime
July 18, 2023
11:59, EEST
Avatar
Francesco Zambon
Member
Members
Forum Posts: 81
Member Since:
December 20, 2021
sp_UserOfflineSmall Offline

Good morning everyone,

I have a doubt about changing the time and the timezone of the OPC UA server at runtime.
According to the EUROMAP 82.1 / 83 specifications I should manage the following nodes:

10.4 TimeZoneOffset
The TimeZoneOffset Property represents the difference of the local time to Coordinated Universal Time (UTC)
given by the machine operator or OPC client.
Information: TimeZoneDataType (as defined in OPC UA Part 3) is a structure with two components:
– offset (0:UInt16): Time difference from UTC in minutes (e.g. 120 for daylight saving time in Berlin)
– daylightSavingInOffset (0:Boolean): If TRUE, then daylight saving time (DST) is in effect and offset includes
the DST correction. If FALSE, then the offset does not include DST correction and DST may or may not
have been in effect.
NOTE: The UTC time itself is part of OPC UA Part 5: ServerStatus → CurrentTime.
10.5 SetMachineTime
The SetMachineTime Method allows setting the server time together with TimeZoneOffset.
Signature
SetMachineTime (
[in] 0:DateTime DateTime
[in] 0:TimeZoneDataType TimeZoneOffset);

Do you think it might be a problem to change the time and the timezone of a Java application running the Prosys SDK?

I think the best thing would be to restart the application.

Thanks.
Best regards,

Francesco.

July 18, 2023
12:51, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

It is per se not possible to “change the timezone of the OPC UA Server”, because there is no such concept in OPC UA (but do read the whole post, in theory maybe there is, but realistically not or like it doesn’t affect anything).
The server always “runs” in UTC and the DateTime DataType always represents the timestamp in UTC when it is transferred in binary between the client and the server. Yes, there is the type https://reference.opcfoundation.org/Core/Part3/v105/docs/8.37 “UtcTime”, but I do not understand thy this type exist since base type of this ‘DateTime’ is already UTC https://reference.opcfoundation.org/Core/Part6/v105/docs/5.2.2.5. Even the UtcTime also says “All time values conveyed between OPC UA Servers and Clients are UTC values. Clients shall provide any conversions between UTC and local time. “. It is possible this is something historical and the type ‘UtcTime’ probably cannot just be removed.

I have limited information, but as far as I’m aware, no-one has ever used the TimeZoneDataType.

In short I do not know what use the ‘SetMachineTime’ does have with that. Maybe the makers of EUROMAP have made a mistake and do not know the above?
Or maybe the timezone is just an extra information, but it wouldn’t like affect at all any time “set by the method”, because that parameter (I assume) is still something DateTime-derived and thus always in UTC (because any simpletype is transferred as the base type rules, thus they must also be in UTC).

I guess it could be of some use to know which timezone the server runs, but it doesn’t affect at all to the timestamps provided by the server. Or I guess in theory IF types derived from String would be used (https://reference.opcfoundation.org/Core/Part3/v105/docs/8.42 or https://reference.opcfoundation.org/Core/Part3/v105/docs/8.46), but I have not seen them ever used.

Note that if you would “set the time of the server”, this would mean setting the time of the Operating System of the machine. And I think probably the timezone as well in the OS level. We do get the time from the system clock.

Changing the clock time on the server could have some implications temporarily, e.g. some java timers do not work that well if the clock “jumps” and may exec really fast temporarily to exec as many times as-if they should have if the time would have flow in a constant manner. Also it might suddenly expire Sessions, SecureChannels and Subscriptions via lifetime-timeouts. In the worst case, it could immediately make a cert unuseable if the clock jumps like years. And I think there was also some requirements that the clocks should be somewhat synchronized when using security, thus, it should be more likely that you run e.g. ‘NTP’ or something that will keep them in sync instead.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 684

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1