Supported platforms: CODESYS 3.5

 

GetSystemDateAndTime (PRG)

Description

When enabled, the program will get the operating system time once per second to o_SystemTime by using CAA DTUtil library.

 

The offset input can be used to apply timezone difference in minutes to o_UITime.

For example, GlobE sets OS to UTC time, which may not match with the local time.            

 

If an error is encountered in DTUtil library, then the time will be frozen to previous successful value.

The error can be reset by setting enable input to false.

 

Limitations

Program is included in 6107int library version 3.1.3.0 or newer.

 

CAA DTUtil library is required.

Inputs

Input variable name

Data type

Range

Default

Description

i_Enable

BOOL

N/A

FALSE

System time will be get when enable = TRUE

i_Offset

INT

N/A

0

Offset in minutes, applied to UI time

Outputs

Output variable name

Data type

Range

Default

Description

o_SystemTime

DT

N/A

1.1.1970 00:00

Operating system current date and time

o_UITime

DT

N/A

1.1.1970 00:00

Current date and time with offset for UI

o_Error

DTU.ERROR

See enum

NO_ERROR

DTU library error code, NO_ERROR when OK

Example code

Program is included in MultiTool project template in SDK 3.0 with 6000 series device description 1.3.1.X or newer or MultiTool Creator.

 

 

Definitions:

 

SystemTimeEnable: BOOL := TRUE;

SystemTime: DT;

SystemTimeError: DTU.ERROR;

UITime: DT;

UITimeOffset: INT := INT#0;

 

 

Code:

 

EPEC_6000INT.GetSystemDateAndTime(

i_Enable := SystemTimeEnable,

i_Offset := UITimeOffset,

o_SystemTime => SystemTime,

o_UITime => UITime,

o_Error => SystemTimeError

);

 

 

See also

 

 

 

Source file topic100434.htm

Last updated 24-Apr-2025