Documentos de Académico
Documentos de Profesional
Documentos de Cultura
CoDeSys V 3.x
SysTime.library
CONTENT
1 OVERVIEW 3
2 LIBRARY MODULES 4
2.1 General time functions 4
2.1.1 SysTimeGetMs 4
2.1.2 SysTimeGetNs 4
2.1.3 SysTimeGetUs 4
2.2 RTC - High Resolution functions 4
2.2.1 SysTimeRtcConvertDateToHighRes 5
2.2.2 SysTimeRtcConvertHighResToDate 5
2.2.3 SysTimeRtcHighResGet 5
2.2.4 SysTimeRtcHighResSet 5
2.3 RTC - Standard Functions 6
2.3.1 SysTimeRtcControl 6
2.3.2 SysTimeRtcConvertDateToUtc 6
2.3.3 SysTimeRtcConvertLocalToUtc 6
2.3.4 SysTimeRtcConvertUtcToDate 7
2.3.5 SysTimeRtcConvertUtcToLocal 7
2.3.6 SysTimeRtcGet 7
2.3.7 SysTimeRtcGetTimezone 7
2.3.8 SysTimeRtcSet 8
2.3.9 SysTimeRtcSetTimezone 8
2.3.10 SysTimeGetDate 8
2.3.11 SysTimeGetTimestamp 8
2.4 Data types, Structures 9
2.4.1 Data type SysTime 9
2.4.2 Structure SysTimeDate 9
2.4.3 Structure TimezoneInformation 9
CHANGE HISTORY 10
libdoc_e.dot / V1.0
1 Overview
Note: It depends on the target system, which system libraries can be used in the application program..
If the target system supports the functionality, the functions of this library allow to read resp.
set the realtime clock of the local system as well as various conversions of the clock time
data. The time data are handled IEC-conforming and in data type UDINT.
Terms:
The functions:
SysTimeGetMs
SysTimeGetNs
SysTimeGetUs
RTC
SysTimeRtcConvertDataToHighRes
SysTimeRtcConvertHighResToDate
SysTimeRtcHighResGet
SysTimeRtcHighResSet
Standard
SysTimeRtcControl
SysTimeRtcConvertDateToUtc
SysTimeRtcConvertLocalToUtc
SysTimeRtcConvertUtcToDate
SysTimeRtcConvertUtcToLocal
SysTimeRtcGet
SysTimeRtcGetTimezone
SysTimeRtcSet
SysTimeRtcSetTimezone
SysTimeDate
TimezoneInformation
2 Library Modules
2.1.1 SysTimeGetMs
This function reads the current system time.
The return value of type UDINT gives the current time in milliseconds [ms].
2.1.2 SysTimeGetNs
This function reads the current system time.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput Data type Description
Variable
NsTime SysTime After function call this parameter will show the system
time in nanoseconds.
2.1.3 SysTimeGetUs
Diese function reads the current system time.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput Data type Description
Variable
UsTime SysTime After function call this parameter will show the system
time in microseconds.
UTC time: current coordinated universal time; has replaced the Greenwich Mean Time.
The time zones are given as positive or negative deviation from UTC.:
e.g. UTC+1 corresponds to the Central European Time (CET) and
UTC+2 corresponds to the Central European Summer Time (CEST)
Local time: Local time including daylight time (summer time) and time zone shift
Due to the fact that only the UTC time is globally unique, on most systems only the UTC time
libdoc_e.dot / V1.0
is stored and processed. By using the additional information time zone and summer time
the local time can be computed from the UTC.
2.2.1 SysTimeRtcConvertDateToHighRes
This function converts the time given by variable pDate (format SysTimeDate) into a High
Resolution Time of format SysTime.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput- Data type Description
Variable
2.2.2 SysTimeRtcConvertHighResToDate
This function converts the time given by variable pTimestamp (format SysTime) into format
SysTimeDate.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput- Data type Description
Variable
2.2.3 SysTimeRtcHighResGet
This function provides the time (milliseconds) which has passed since 01.01.1970 00:00:00
(RTC).
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput- Data type Description
Variable
2.2.4 SysTimeRtcHighResSet
This function sets the Real Time Clock.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput- Data type Description
Variable
libdoc_e.dot / V1.0
2.3.1 SysTimeRtcControl
This function can be used to manage the Real Time Clock and to read the hardware status
information.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.2 SysTimeRtcConvertDateToUtc
This function converts the system time (format SysTimeDate) into the UTC time format.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput-Variable Data type Description
2.3.3 SysTimeRtcConvertLocalToUtc
This function converts the local time into the UTC time format.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.4 SysTimeRtcConvertUtcToDate
This function converts the UTC time into the local time (format SysTimeDate).
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.5 SysTimeRtcConvertUtcToLocal
This function converts the UTC time into the local time.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.6 SysTimeRtcGet
This function reads the current RTC system time.
The return value of type DWORD contains the RTC time since 01.01.1970 00:00:00 in
seconds.
Input-Variable Data type Description
2.3.7 SysTimeRtcGetTimezone
This function detects the effective RTC time zone.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
libdoc_e.dot / V1.0
2.3.8 SysTimeRtcSet
This function sets the current RTC system time.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.9 SysTimeRtcSetTimezone
This function sets the current RTC time zone.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
Input-Variable Data type Description
2.3.10 SysTimeGetDate
This function detects the current time in SysTimeDate format.
The return value of type RTS_IEC_RESULT gives an error code, which informs about the
success of the operation. See document Runtime Error Codes.
InputOutput-Variable Data type Description
2.3.11 SysTimeGetTimestamp
This function detects the current timestamp (=SysTimeRtcGet).
The return value of type UDINT contains the RTC time since 01.01.1970 00:00:00 in
milliseconds.
libdoc_e.dot / V1.0
ulStandardDate UDINT Date for switching from daylight time to normal time
ulDaylightDate UDINT Date for switching from normal time to daylight time
Change History
Version Description Date