Implements CONFIG_TIME_EXTENDED as we discussed relative to providing the last 3 members of the tm struct and support for filling them in and even using the wday in the STM32 RTC. From David Sidrane.

This commit is contained in:
Gregory Nutt
2015-04-08 06:56:43 -06:00
parent b4423c1eed
commit 190c9adef0
7 changed files with 168 additions and 11 deletions
+21 -1
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/time.h
*
* Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved.
* Copyright (C) 2009, 2011, 2015 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -100,6 +100,26 @@ int clock_isleapyear(int year);
int clock_daysbeforemonth(int month, bool leapyear);
/****************************************************************************
* Function: clock_dayoftheweek
*
* Description:
* Get the day of the week
*
* Input Parameters:
* mday - The day of the month 1 - 31
* month - The month of the year 1 - 12
* year - the year including the 1900
*
* Returned value:
* Zero based day of the week 0-6, 0 = Sunday, 1 = Monday... 6 = Saturday
*
****************************************************************************/
#if defined(CONFIG_TIME_EXTENDED)
int clock_dayoftheweek(int mday, int month, int year);
#endif
/****************************************************************************
* Function: clock_calendar2utc
*
+1 -1
View File
@@ -136,7 +136,7 @@ struct tm
int tm_mday; /* Day of the month (1-31) */
int tm_mon; /* Month (0-11) */
int tm_year; /* Years since 1900 */
#ifdef CONFIG_LIBC_LOCALTIME
#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
int tm_wday; /* Day of the week (0-6) */
int tm_yday; /* Day of the year (0-365) */
int tm_isdst; /* Non-0 if daylight savings time is in effect */