CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Wed Nov 13, 2019 4:12 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Sep 12, 2013 5:15 pm 
Offline

Joined: Fri Nov 23, 2012 11:42 am
Posts: 54
I am trying to extract the timestamp for alarm events inside an implementation of IAlarmNotifier. The value returned by IAlarm.GetTimestampActive is of type Timestamp.

The documentation for this type states
Quote:
A type similar to SysTimeCore.SYSTIME, that is a signed type in contrast to the unsigned type SysTimeCore.SYSTIME. This signed type avoids warning during the IEC code conversion (because the IEC type ULINT doesn't have an exact counterpart in in java). The signed type can be used without any problems because using the 63 bits of the LINT value allows us to represents dates up to the year 30000.


When I look at SysTimeCore.SYSTIME its documentation states
Quote:
High resolution time datatype to hold ticks
I find the type used to hold ticks in microseconds or nanoseconds. My understanding though is that this time is NOT linked to the RTC.

What I was hoping to do was to extract the timestamp values and manipulate them to be milliseconds from 1970. Is this possible?


Top
   
PostPosted: Tue Sep 17, 2013 12:31 pm 
Offline
Frequent User
Frequent User
User avatar

Joined: Tue Jun 06, 2006 9:03 am
Posts: 410
I am not sure, but I think you should use the library "SysTimeRtc" to convert the Timestamp to a structure of type RTS_SYSTIMEDATE.
See the function "SysTimeRtcConvertHighResToDate".


Top
   
PostPosted: Wed Aug 17, 2016 2:49 pm 
Offline

Joined: Tue Jun 21, 2016 8:03 am
Posts: 1
I bumped into the same problem - the values given by IAlarm.GetTimestampActive-method certainly don't seem to be in SYSTIME format. It counts microseconds, but the values are absurdly big (getting 131159217192180000 right now, which even adjusted to seconds would be in very distant future by epoch time).

The timestamps shown in Alarm Table-visualization component do make sense, so is this a (known) bug or documentation defect in AlarmManager library?


Top
   
PostPosted: Thu Aug 18, 2016 1:36 pm 
Offline

Joined: Mon Jan 14, 2013 3:47 pm
Posts: 73
The value returned by GetTimestampActive is an AlarmManager.TIMESTAMP:
This is a LINT, which returns the time since 01.01.1601 in 10 ^-7s.

With the function AlarmManager.AlarmStorageConvertFromTimestamp the value can be converted in a SysTimeRtc.SYSTIMEDATE .


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited