Table of Contents

PC (PLC) Time

Block name

B99_PCTIMENODE

ST call

PROGRAM TEST B99
   VAR
     LINT1 : LINT; // CAS V SEKUNDáCH
    SINT1,SINT2,SINT3 :SINT;
    END_VAR
 LINT1 := LIB.CORE.V1_0.B99_PCTIMENODE(LOCAL:=TRUE, SEC=>SINT1,MIN=>SINT2,HOUR=>SINT3);
END_PROGRAM

Library

LIB\CORE

Version

V1.0

Description

The block returns UTC or local time, together with iother time units.

Inputs

InputTypeDescription Default value
LOCALBOOLLocal or UTC time? (UTC = false, Local = true)True

Outputs

Output TypeDescription
LINTTime in s
MSEC INT Milliseconds (May not be supported for certain platforms)
SEC SINTSeconds
MIN SINTMinutes
HOUR SINTHours
DAY SINTDays
WDAY SINTDay of week (0 = Sunday, 1 = Monday, …, 6 = Saturday)
MON SINTMonths
YEAR INT Years
DAYLIGHT BOOLdaylight=true means that the Daylight saving time (DST) is active (only makes sense for local time)
REMAINDAYSINTRemaining days until end of the month (last day: remainday = 0)

Function

The block outputs the real time of the SoftPLC. The output gives total time in seconds starting at 1.1.1970, 0:00, and the wday output indicates the day of week (0 = Sunday, 1 = Monday, …, 6 = Saturday).

The parameter local specifies if the time to consider is UTC or local time (local=true means time of the PC or PLC-preset time zone).

Poznámka

For MiniPLC platform-based controllers, the msec output = 0.

Application example

The block is used for periodical launching of programs and events, such as meter reading (e.g. last day of the month at 23:00), or for general time/date based calculations.