DATETIME – Get, set and convert time

Block SymbolLicensing group: STANDARD
PIC

Function Description
The DATETIME block is intended for advanced date/time operations in the REX control system.

It allows synchronization of the operating system clock and the clock of the REX control system. When the executive of the REX control system is initialized, both clocks are the same. But during long-term operation the clocks may loose synchronization (e.g. due to daylight saving time). If re-synchronization is required, the rising edge (off on) at the SET input adjusts the clock of the REX control system according to the block inputs and parameters.

It is highly recommended not to adjust the REX control system time when the controlled machine/process is in operation. Unexpected behavior might occur.

If date/time reading or conversion is required, the rising edge (off on) at the GET input triggers the action and the block outputs are updated. The outputs starting with ’t’ denote the total number of respective units since January 1st, 2000 UTC.

Both reading and adjusting clock can be repeated periodically if set by getper and setper parameters.

If the difference of the two clocks is below the tolerance limit settol, the clock of the REX control system is not adjusted at once, a gradual synchronization is used instead. In such a case, the timing of the REX control system executive is negligibly altered and the clocks synchronization is achieved after some time. Afterwards the timing of the REX executive is reverted back to normal.

For simple date/time reading use the DATE_ and TIME function blocks.

Inputs

uyear

Input for setting year

long

umonth

Input for setting month

long

uday

Input for setting day

long

uhour

Input for setting hours

long

umin

Input for setting minutes

long

usec

Input for setting seconds

long

unsec

Input for setting nanoseconds   -9,22E+18  9,22E+18

large

SET

Trigger for setting time

bool

GET

Trigger for getting time

bool

Outputs

yyear

Year

long

ymonth

Month

long

yday

Day

long

yhour

Hours

long

ymin

Minutes

long

ysec

Seconds

long

ynsec

Nanoseconds

long

ydow

Day of week

long

ywoy

Week of year

long

tday

Total number of days

long

tsec

Total number of seconds

long

tnsec

Total number of nanoseconds

large

dsec

Number of seconds since midnight

long

Parameters

isetmode

Source for setting time  1

long

1 ....

OS clock

2 ....

Block inputs

3 ....

The unsec input

4 ....

The usec input

5 ....

The unsec input, relative

igetmode

Source for getting or converting time  6

long

1 ....

OS clock

2 ....

Block inputs

3 ....

The unsec input

4 ....

The usec input

5 ....

The uday input

6 ....

REX clock

settol

Tolerance for setting the REX clock [s]  1.0

double

setper

Period for setting time [s] (0=not periodic)

double

getper

Period for getting time [s] (0=not periodic)  0.001

double

FDOW

First day of week is Sunday

bool

off ..

Week starts on Monday

on ...

Week starts on Sunday

tz

Timezone  1

long

1 ....

Local time

2 ....

UTC