mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 17:33:08 +08:00
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:
+21
-1
@@ -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
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user