Skip to content

What it the RTC_TYPE?

I can find no documentation on this in the Help file. I understand that it represents a real time clock, but it appears that nothing can be done with this type. Math is not allowed(which I would like to do), and converting to TIME isn't allowed.

Comments

  • RTC_TYPE is simply a STRUCT data type that is built-in to PLCnext Engineer.
    It is used by the RTC global variable to store the system time.
    You can declare other variables using this type, but this will only create a STRUCT variable containing the fields defined by that data type (HOURS, MINUTES, SECONDS, etc).

    You can use the individual fields of the RTC variable as inputs to arithmetic operations, and then store the results in other variables e.g. in the fields of another variable of type RTC_TYPE.
  • OK. What is the source of RTC before it become a STRUCT? Is there a UDINT somewhere that gets interpreted?
  • I'm fairly sure the RTC variable is populated in the background from a system call to the static C# (eCLR) function DateTime.Now.

    Apart from the String variable that is returned from the RTC_S function, there isn't any other format of the current time available directly in IEC code from standard PLCnext Engineer functions, that I'm aware of.
  • I also see that there are some DateTime functions in tbe PLCnextBase library in the PLCnext Store that might help:
    https://www.plcnextstore.com/permalinks/apps/latest/60002172000027
Sign In or Register to comment.