BinaryTime6_To_String
Converts the components of the structured type T_BinaryTime into a formatted Binary-Time string. The resulting string has the following structure: ‘BT#[YYYY-MM-DD-]hh:mm:ss[.nnn]‘. It corresponds to the TwinCAT Binary-Time string format specification.
Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)
Syntax
FUNCTION BinaryTime6_To_String : STRING(26)
VAR_INPUT
in : T_BinaryTime;
END_VAR
VAR_OUTPUT
bError : BOOL;
END_VAR
Inputs
Name | Type | Description |
---|---|---|
in | The time information to be converted as a Binary-Time structure. |
Outputs
Name | Type | Description |
---|---|---|
bError | BOOL | The output is "TRUE" if the value of the in.day component is greater than "16#AE35" (this corresponds to February 7, 2106). In this case the function returns an empty string. |
Return value
Name | Type | Description |
---|---|---|
BinaryTime6_To_String | STRING(26) | Converted time information as a Binary-Time string. |
Sample
METHOD BinaryTime6_ToFrom_String : BOOL
VAR_INPUT
fbIED : REFERENCE TO FB_IED;
END_VAR
VAR
tValue : T_BinaryTime;
sValue : STRING;
END_VAR
IF NOT __ISVALIDREF(fbIED) THEN
RETURN;
END_IF
tValue := String_To_BinaryTime6('BT#01:02:03');
sValue := BinaryTime6_To_String(tValue); (* sValue := 'BT#1984-01-01-01:02:03' *)
IF fbIED.Relay.LLN0.brcb1.TimeOfEntry.sValue <> sValue THEN
tValue := fbIED.Relay.LLN0.brcb1.TimeOfEntry.tValue;
END_IF
tValue := String_To_BinaryTime6('BT#04:05:06.7');
sValue := BinaryTime6_To_String(tValue);(* sValue := 'BT#1984-01-01-04:05:06.700' *)
IF fbIED.Relay.LLN0.brcb2.TimeOfEntry.sValue <> sValue THEN
tValue := fbIED.Relay.LLN0.brcb2.TimeOfEntry.tValue;
END_IF
tValue := String_To_BinaryTime6('BT#2017-01-18-11:12:13');
sValue := BinaryTime6_To_String(tValue);(* sValue := 'BT#2017-01-18-11:12:13' *)
IF fbIED.Relay.LLN0.brcb3.TimeOfEntry.sValue <> sValue THEN
tValue := fbIED.Relay.LLN0.brcb3.TimeOfEntry.tValue;
END_IF
BinaryTime6_ToFrom_String := TRUE;