# HG changeset patch
# User mjsousa
# Date 1487535182 0
# Node ID dcf358607302cda89e538a3c8bbd1783b8803816
# Parent  7a4b29e25481552a776d36ed9eb901b0c0871be1
Fix date conversion function (seconds to Date_and_Time). First day of month was falling on previous month.

diff -r 7a4b29e25481 -r dcf358607302 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;