Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2011-08-19 18:14:18 +0400
committerCorinna Vinschen <corinna@vinschen.de>2011-08-19 18:14:18 +0400
commit6648762916a0669e7f95b21cb2c39fb462114121 (patch)
tree7b374a5b5411f5fa6478a9da8bda95587f668b29
parentaeeaae457b1726accde5ecf0ac715c3a2aadf929 (diff)
* libc/time/mktime.c (validate_structure): Account for tm_mon possibly
being given as negative. (mktime): Set tm_isdst=0 when !daylight.
-rw-r--r--newlib/ChangeLog6
-rw-r--r--newlib/libc/time/mktime.c13
2 files changed, 13 insertions, 6 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 5d2053183..f600792e4 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-19 Craig Howland <howland@LGSInnovations.com>
+
+ * libc/time/mktime.c (validate_structure): Account for tm_mon possibly
+ being given as negative.
+ (mktime): Set tm_isdst=0 when !daylight.
+
2011-08-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/types.h: XML and RTEMS define
diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c
index acd5d3aa0..93ca5c3a7 100644
--- a/newlib/libc/time/mktime.c
+++ b/newlib/libc/time/mktime.c
@@ -107,7 +107,7 @@ _DEFUN(validate_structure, (tim_p),
}
}
- if (tim_p->tm_mon > 11)
+ if (tim_p->tm_mon < 0 || tim_p->tm_mon > 11)
{
res = div (tim_p->tm_mon, 12);
tim_p->tm_year += res.quot;
@@ -159,7 +159,7 @@ _DEFUN(mktime, (tim_p),
{
time_t tim = 0;
long days = 0;
- int year, isdst, tm_isdst;
+ int year, isdst=0;
__tzinfo_type *tz = __gettzinfo ();
/* validate structure */
@@ -204,15 +204,16 @@ _DEFUN(mktime, (tim_p),
/* compute total seconds */
tim += (days * _SEC_IN_DAY);
- /* Convert user positive into 1 */
- tm_isdst = tim_p->tm_isdst > 0 ? 1 : tim_p->tm_isdst;
- isdst = tm_isdst;
-
TZ_LOCK;
if (_daylight)
{
+ int tm_isdst;
int y = tim_p->tm_year + YEAR_BASE;
+ /* Convert user positive into 1 */
+ tm_isdst = tim_p->tm_isdst > 0 ? 1 : tim_p->tm_isdst;
+ isdst = tm_isdst;
+
if (y == tz->__tzyear || __tzcalc_limits (y))
{
/* calculate start of dst in dst local time and