BinaryTime_To_SystemTime

Converts the time information of type T_BinaryTime (binary time format) to the time information of type TIMESTRUCT (system time format). In case of conversion error the output variable "bOverflow" has the value "TRUE" and the returned system time value has the date:1970-01-01 and the time: 0h0m0s0ms.

Namespace: Tc3_Collections
Library: Tc3_Collections (Tc3_Collections.compiled-library)

Syntax

FUNCTION BinaryTime_To_SystemTime : TIMESTRUCT
VAR_INPUT
    in        : T_BinaryTime;
END_VAR
VAR_OUTPUT
    bOverflow : BOOL;
END_VAR

BinaryTime_To_SystemTime 1: Inputs

Name

Type

Description

in

T_BinaryTime

The time information to be converted as a Binary-Time structure.

BinaryTime_To_SystemTime 2: Outputs

Name

Type

Description

bOverflow

BOOL

Date overflow if "TRUE". In this case, the binary time to be converted has a date (T_BinaryTime.day member) greater than 2106-02-07.

BinaryTime_To_SystemTime 3: Return value

Name

Type

Description

BinaryTime_To_SystemTime

TIMESTRUCT

Converted time information as a System-Time structure.

Sample

PROGRAM MAIN
VAR
    tSystem   : TIMESTRUCT;
    tBinary   : T_BinaryTime;
    bOverflow : BOOL;
END_VAR
tSystem.wYear:=2022;
tSystem.wMonth:=9;
tSystem.wDay:=16;
tSystem.wHour:=12;
tSystem.wMinute:=52;
tSystem.wSecond:=4;
tSystem.wMilliseconds:=500;
tBinary:=SystemTime_To_BinaryTime(in:=tSystem, bOverflow=>bOverflow);(* Returns tBinary.timeOfDay = TOD#12:52:04.500 and tBinary.day = 14138 *)

tBinary.day:=1;
tBinary.timeOfDay:=TOD#01:30:15.500;
tSystem:=BinaryTime_To_SystemTime(in:=tBinary, bOverflow=>bOverflow);(* Returns system-time date: 1984-01-02 and time: 01h30m15s500ms*)