Examples CAA_RealTimeClock.library

GetDateAndTime

VAR

   RTCLK.getdt : RTCLK.GetDateAndTime;

   dtDate : DATE_AND_TIME;

   eTZ : RTCLK.PERIODE;

END_VAR

 

RTCLK.getdt.xExecute := TRUE;

RTCLK.getdt();

                                  

IF RTCLK.getdt.xError THEN

    ; // error handling

END_IF

                                  

IF RTCLK.getdt.xDone THEN

    // done without error

 dtDate := RTCLK.getdt.dtDateAndTime;

 eTZ := RTCLK.getdt.eTimezone;

END_IF

 

SetDateAndTime

VAR

  RTCLK.setdt : RTCLK.SetDateAndTime;

END_VAR

 

RTCLK.setdt.dtDateAndTime := DATE_AND_TIME#2008-05-19-20:00:00;

RTCLK.setdt.xExecute := TRUE;

RTCLK.setdt();

                                  

IF RTCLK.setdt.xError THEN

      ; // error handling

END_IF

                                  

IF RTCLK.setdt.xDone THEN

      ; // done without error

END_IF

 

GetTimeZoneInformation

VAR

  RTCLK.gettzi : RTCLK.GetTimeZoneInformation;

  tziInfo : RTCLK.TIME_ZONE_INFO;

END_VAR

 

RTCLK.gettzi.xExecute := TRUE;

RTCLK.gettzi();

                                  

IF RTCLK.gettzi.xError THEN

      ; // error handling

END_IF

                                  

IF RTCLK.gettzi.xDone THEN

      // done without error

  tziInfo := RTCLK.gettzi.tziInfo;

END_IF

 

SetTimeZoneInformation

VAR

RTCLK.settzi : RTCLK.SetTimeZoneInformation;

END_VAR

 

RTCLK.settzi.tziInfo := DTU.gc_tziTimeZoneCET;

RTCLK.settzi.xExecute := TRUE;

RTCLK.settzi();

                                  

IF RTCLK.settzi.xError THEN

     ; // error handling

END_IF

                       

IF RTCLK.settzi.xDone THEN

     ; // done without error

END_IF