summaryrefslogtreecommitdiff
path: root/nuttx/lib/lib_mktime.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-07-12 15:16:00 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-07-12 15:16:00 +0000
commit2c0b1a2f8d2294ff3486ba04752cd1bd4b3e279c (patch)
tree44bb9f30de044b53805bb77ca5df5b706ea504ad /nuttx/lib/lib_mktime.c
parent32498f8db8a4194609e334ea95b3de569bd92784 (diff)
downloadpx4-nuttx-2c0b1a2f8d2294ff3486ba04752cd1bd4b3e279c.tar.gz
px4-nuttx-2c0b1a2f8d2294ff3486ba04752cd1bd4b3e279c.tar.bz2
px4-nuttx-2c0b1a2f8d2294ff3486ba04752cd1bd4b3e279c.zip
Add strftime
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1977 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/lib/lib_mktime.c')
-rw-r--r--nuttx/lib/lib_mktime.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/nuttx/lib/lib_mktime.c b/nuttx/lib/lib_mktime.c
index 594a0672b..46e16c50f 100644
--- a/nuttx/lib/lib_mktime.c
+++ b/nuttx/lib/lib_mktime.c
@@ -86,7 +86,7 @@
****************************************************************************/
#ifdef CONFIG_GREGORIAN_TIME
-time_t mktime(struct tm *tp)
+time_t mktime(const struct tm *tp)
{
time_t ret;
time_t jdn;
@@ -114,7 +114,7 @@ time_t mktime(struct tm *tp)
* seconds, etc. apply.
*/
-time_t mktime(struct tm *tp)
+time_t mktime(const struct tm *tp)
{
unsigned int days;
@@ -126,16 +126,9 @@ time_t mktime(struct tm *tp)
days += (tp->tm_year - 69) >> 2;
- /* Add in the days up to the beginning of this month (ignoring any possible leap day). */
+ /* Add in the days up to the beginning of this month. */
- days += (time_t)g_daysbeforemonth[tp->tm_mon];
-
- /* Add in the leap day for this year (months are zero based) */
-
- if (tp->tm_mon >= 2 && clock_isleapyear(tp->tm_year + 1900))
- {
- days++;
- }
+ days += (time_t)clock_daysbeforemonth(tp->tm_mon, clock_isleapyear(tp->tm_year + 1900));
/* Add in the days since the beginning of this month (days are 1-based). */