Correct time initialization for the case where time is initialized from settings in the .config file. The correct range for month (tm_mon) internally is 0-11, not 1-12 as it is in the .config file.

This commit is contained in:
Gregory Nutt
2016-10-27 08:36:24 -06:00
parent 0967864c92
commit 123c520db4
3 changed files with 14 additions and 32 deletions
+2 -1
View File
@@ -61,6 +61,7 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Standard time definitions (in units of seconds) */
#define SEC_PER_MIN ((time_t)60)
@@ -151,7 +152,7 @@ static inline int clock_basetime(FAR struct timespec *tp)
* month, and date
*/
jdn = clock_calendar2utc(CONFIG_START_YEAR, CONFIG_START_MONTH,
jdn = clock_calendar2utc(CONFIG_START_YEAR, CONFIG_START_MONTH - 1,
CONFIG_START_DAY);
/* Set the base time as seconds into this julian day. */