UTC-Time string format specification
A TwinCAT UTC-Time string has the following structure: ‘UT#YYYY-MM-DD-hh:mm:ss.nnnnnnnnn|LFC|A[A]'.
Variable | Representation | Value range | Description |
---|---|---|---|
Prefix | UT# | ‘UT#‘ | Constant prefix. |
Year | YYYY | ‘1970‘..‘2106‘ | Year (4 decimal places). |
Month | MM | ‘01‘..‘12‘ | Month (2 decimal places). |
Day | DD | ‘01‘..‘31‘ | Day (2 decimal places). |
Hour | hh | ‘00‘..‘23‘ | Hour (2 decimal places). |
Minute | mm | ‘00‘..‘59‘ | Minute (2 decimal places). |
Second | ss | ‘00‘..‘59‘ | Second (2 decimal places). |
Nanosecond | nnnnnnnnn | ‘000000000‘..‘999999999‘ | Nanoseconds: (9 decimal places). |
LeapSecondsKnown | L | ‘0‘..‘1‘ | Quality of the leap second ('0':=unknown, '1':=known). |
ClockFailure | F | ‘0‘..‘1‘ | Quality of the timer ('0':=good, '1':=erroneous). |
ClockNotSynchronized | C | ‘0‘..‘1‘ | Quality of the time synchronization ('0':=synchronized, '1':=not synchronized). |
Accuracy | A[A] | ‘0‘..‘31‘ | Accuracy of the time information (precision of the fraction of a second). Max. number of significant bits in the T_UtcTime.fractionOfSecond component (1 or 2 decimal places). |
Samples
The table below contains strings and the values of the components after conversion to the structured type: T_UtcTime.
STRING(39) | T_UtcTime | Description |
---|---|---|
'UT#1970-01-01-00:00:00.000000000|000|0' | STRUCT(0) | All components have the value: 0. Date: January 1, 1970. Time: 00:00:00. Fraction of a second: 0 ms. Precision: 0-bit. |
'UT#2018-01-02-03:04:05.125000000|010|3' | STRUCT(secondSinceEpoch:=DT#2018-01-02-03:04:05, fractionOfSecond:=[4,0,0], quality:=(ClockFailure:=1, Accuracy3:=1, Accuracy4:=1)) | Date: January 2, 2018. Time: 03:04:05. Fraction of a second: 125000000 ns := 125 ms. Timer signals an error. Precision: 3-bit. All other components have the value: 0. |
'UT#2018-01-02-03:04:05.750000000|001|24' | STRUCT(secondSinceEpoch:=DT#2018-01-02-03:04:05, fractionOfSecond:=[3,0,0], quality:=(ClockNotSynchronized:=1, Accuracy0:=1, Accuracy1:=1)) | Date: January 2, 2018. Time: 03:04:05. Fraction of a second: 750000000 ns := 750 ms. Timer is not synchronized. Precision: 24-bit. All other components have the value: 0. |