SystemTime_To_BinaryTime

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

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

Syntax

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

SystemTime_To_BinaryTime 1: Inputs

Name

Type

Description

in

TIMESTRUCT

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

SystemTime_To_BinaryTime 2: Outputs

Name

Type

Description

bOverflow

BOOL

Date overflow if "TRUE". In this case the system time to be converted has a date greater than 2106-02-07.

SystemTime_To_BinaryTime 3: Return value

Name

Type

Description

SystemTime_To_BinaryTime

T_BinaryTime

Converted time information as Binary-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*)