Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

IAlarm.GetTimestampActive return value to UTC?

2013-09-12
2016-08-18
  • DavidCozens - 2013-09-12

    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 >Zitat:
    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 >Zitat:
    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?

     
  • TimvH

    TimvH - 2013-09-17

    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".

     
  • tuna - 2016-08-17

    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?

     
  • Moderator3S

    Moderator3S - 2016-08-18

    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 .

     

Log in to post a comment.