Autor Thema: Minor bug in RTC_2 FB  (Gelesen 4977 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

Strucc

  • Gast
Minor bug in RTC_2 FB
« am: 19. Mai 2011, 07:51:07 »
Hi,

While implementing SNTB based time synchronization I found a minor bug with the DST offset calculation:

Line 9-10:
(* calculate time offset and set ldt output *)
LDT := DWORD_TO_DT(DT_TO_DWORD(UDT) + INT_TO_DWORD(ofs + BOOL_TO_INT(DSO)) * 60);


Should be:
(* calculate time offset and set ldt output *)
LDT := DWORD_TO_DT(DT_TO_DWORD(UDT) + INT_TO_DWORD(ofs + (BOOL_TO_INT(DSO) *60)) * 60);


This was within library for CoDeSys 2.

By the way thanks for all the ideas and work within these libraries: really great and useful stuff. I'm looking forward to contribute.

P.Peter

Strucc

  • Gast
Re:Minor bug in RTC_2 FB
« Antwort #1 am: 19. Mai 2011, 08:20:11 »
By the way, it  could be more correct to reuse the UTC_TO_LTIME function:

(* calculate time offset and set ldt output *)
LDT := UTC_TO_LTIME(UDT, DSO, OFS);


« Letzte Änderung: 19. Mai 2011, 08:40:01 von Strucc »