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
Time Variation due to Day-light-save
March 15, 2017
12:47, EET
Avatar
peterrob45
Member
Members
Forum Posts: 25
Member Since:
March 9, 2017
sp_UserOfflineSmall Offline

Hi all,

I have a question, I am getting Timestamp output from the server, as like this 10:42:20.2720000 GMT but actually, my question is, in my simulation server the time running is 11:42:20.2720000 GMT.
Why can’t I print the correct time?
How can I get the exact time value? (as like in my desktop/PC).

Regards.

March 21, 2017
14:56, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Some questions:
1. Version number of Simulation Server
2. What does simulation server Status view display as Current Server Time (e.g. here in Finland that is currently 2017-03-21 14:48:50+0200 )
3. How are you observing/printing the time?
4. In which timezone you are running the Simulation Server

OPC UA DateTime’s are in UTC, Simulation Server does convert these as local time for the UI, but the actual transmitted values to clients are in UTC.

– Bjarne

March 22, 2017
14:01, EET
Avatar
peterrob45
Member
Members
Forum Posts: 25
Member Since:
March 9, 2017
sp_UserOfflineSmall Offline

HI,

1) OPC UA Simulation Server 2.2.2-109.
2) In my simulation server status, the time is showing the correct way such as
3) I am printing my output for the tag Counter1 and their time stamp such as a (value=256 and time= 22.03.2017 12:58:50.256) but its printing like this (value=256 and time= 22.03.2017 11:58:50.256).
4) I am running in CET time zone.

Is there any way to convert the timing ?

Thanks

March 22, 2017
14:47, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

For 3. I meant that which client application or SDK are you using to read the value? i.e. code if you are developing the client via an SDK. If it is an already existing client application there might be some configuration parameter.

For SDKs you have to ask the vendor of that SDK. Anyway since you can get it in UTC you can just convert it manually , how to do that is basic programming knowledge and outside the scope of this forum. Still it is probably best if you read the UA Spec v.1.03 Part 6 section 5.2.2.5 on UA DateTime as the values are in unit 100 nanoseconds from jan 1, 1601 UTC

IF you are using the Java SDK, then you could set DateTime.setUseLocalTimeInToString(true) for DateTime.toString to print local time based on the JVM’s timezone, but I would not use that for anything other than debugging prints. Instead you would get the value as “Java units” with DateTime.getTimeInMillis which would give you the standard Java milliseconds between the time and midnight, January 1, 1970 UTC which you would pass normally to http://www.joda.org/joda-time/ or if running Java 8 or later to java.time API.

– Bjarne

March 28, 2017
16:24, EEST
Avatar
peterrob45
Member
Members
Forum Posts: 25
Member Since:
March 9, 2017
sp_UserOfflineSmall Offline

Hi Bjarne,

Thanks for the suggestion, the above problem is solved. What I am trying now is I don’t want the millisecond in my timestamp. If I am using normal java code I can use some syntax like this to overcome this problem.

System.out.println(new SimpleDateFormat(“MM/dd/yyyy hh:mm:ss”).format(date));
then the output would be something like this 03/28/2017 03:01:55

While printing our server timestamp by these code System.out.println(“” + dv.getServerTimestamp()); output will be like this 03/28/2017 03:01:55:125600 CEST

My question is can we remove the millisecond and CEST? because I am using this for SQL data logging, I need the exact value.

Regards.

March 28, 2017
19:31, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

You can use

DateTime.setStrFormat("%TD %TT");

to define a string format without subsecond accurracy to be used in DateTime.toString()

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 728

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1