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: 435
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: 435
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, EET
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, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 834
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: 267

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 91

pramanj: 86

ibrahim: 68

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

peterrob45: 25

Member Stats:

Guest Posters: 0

Members: 918

Moderators: 12

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 913

Posts: 3829

Newest Members:

fcalvez, prasha173, simonk, c70015@gmail.com, carmelnle23, Vishwanath H, jonghwi kwon, sourabh_mishra, angel, sve

Moderators: Jouni Aro: 834, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 435, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 16, Markus Johansson: 6

Administrators: admin: 0