meta data for this page
  •  
TIME type variables

TIME types mainly serve for timing purposes. The most common type in programs is simple TIME, such as in connection with IEC timings, like this:

TIME example 1

These will be discussed later, but in the example above, the time (PT) is specified in TIME format, with 12 seconds written as t#12s.

TIME is a DINT type variable that stores time in 32 bits, measured in milliseconds. The stored value can be positive or negative, and the rules for negative integers apply, meaning negative TIME values cannot be represented in hexadecimal or binary form.

The same rules apply to the LTIME type, but it stores nanoseconds in an LINT variable, using 64 bits. Interestingly, the maximum value of LTIME is 106,751 days, or about 292 years.

The S5TIME type was included among the variables for downward compatibility; it was the default (and only) time type during the S5 PLC era.

TypeLength (form)Value Range HEXValue Range DECExample
TIME32 bit (DINT)0 .. 7FFF_FFFFT#-24d20h31m23s648ms .. T#+24d20h31m23s647msT#12s, 16#ABCD
LTIME64 bit (LINT)0 .. 7FFF_FFFF_ FFFF_FFFFLT#-106751d23h47m16s 854ms775us808ns .. LT#+106751d23h47m16s 854ms775us807ns LT#12sLTIME#12s, 16#ABCD
S5TIME16 bitS5T#0H_0M_0S_0MS .. S5T#2H_46M_30S_0MSS5T#10s, S5TIME#10s