diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index ff55c0655a..244a7889a3 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -8,7 +8,7 @@
NuttShell (NSH)
- Last Updated: August 7, 2014
+ Last Updated: April 11, 2015
|
@@ -1181,7 +1181,6 @@ date [-s "MMM DD HH:MM:SS YYYY"]
Synopsis.
Show or set the current date and time.
- This command is only supported if the platform supported RTC hardware (CONFIG_RTC=y
).
Only one format is used both on display and when setting the date/time:
@@ -2568,7 +2567,7 @@ nsh>
date |
- CONFIG_RTC |
+
|
CONFIG_NSH_DISABLE_DATE |
diff --git a/libc/Kconfig b/libc/Kconfig
index 967a9f4d4a..0ee8e6b5a3 100644
--- a/libc/Kconfig
+++ b/libc/Kconfig
@@ -288,6 +288,7 @@ endif
config TIME_EXTENDED
bool "Add day of week, year support"
default "n"
+ depends on !LIBC_LOCALTIME
---help---
Selecting TIME_EXTENDED adds tm_wday, tm_yday and tm_isdst
to the tm struct. This allows integration with 3rd party libraries
diff --git a/libc/time/lib_localtime.c b/libc/time/lib_localtime.c
index 26f0c17ce0..646b3e6df4 100644
--- a/libc/time/lib_localtime.c
+++ b/libc/time/lib_localtime.c
@@ -2158,6 +2158,7 @@ static time_t time2sub(struct tm *const tmp,
li = y + (1 < yourtm.tm_mon);
yourtm.tm_mday += year_lengths[isleap(li)];
}
+
while (yourtm.tm_mday > DAYSPERLYEAR)
{
li = y + (1 < yourtm.tm_mon);
@@ -2167,6 +2168,7 @@ static time_t time2sub(struct tm *const tmp,
return -1;
}
}
+
for (;;)
{
i = mon_lengths[isleap(y)][yourtm.tm_mon];