Fix date conversion function (seconds to Date_and_Time). First day of month was falling on previous month.
authormjsousa
Sun, 19 Feb 2017 20:13:02 +0000
changeset 1033 dcf358607302
parent 1032 7a4b29e25481
child 1034 f802b5494d56
Fix date conversion function (seconds to Date_and_Time). First day of month was falling on previous month.
lib/C/iec_std_lib.h
--- a/lib/C/iec_std_lib.h	Wed Jan 25 19:50:39 2017 +0000
+++ b/lib/C/iec_std_lib.h	Sun Feb 19 20:13:02 2017 +0000
@@ -318,7 +318,7 @@
 	  days += __isleap(dt.tm_year) ? 366 : 365;
   }
   dt.tm_mon = 1;
-  while (days > __mon_yday[__isleap(dt.tm_year)][dt.tm_mon]) {
+  while (days >= __mon_yday[__isleap(dt.tm_year)][dt.tm_mon]) {
 	  dt.tm_mon += 1;
   }
   dt.tm_day = days - __mon_yday[__isleap(dt.tm_year)][dt.tm_mon - 1] + 1;