# HG changeset patch # User jwe # Date 1191976397 0 # Node ID 963878fa32678212fb50b16d35683d6ba5c27ab0 # Parent 3fbf49bde6d4a5648dbf31baf10be6ce0a95e123 [project @ 2007-10-10 00:33:17 by jwe] diff -r 3fbf49bde6d4 -r 963878fa3267 liboctave/ChangeLog --- a/liboctave/ChangeLog Wed Oct 10 00:21:29 2007 +0000 +++ b/liboctave/ChangeLog Wed Oct 10 00:33:17 2007 +0000 @@ -5,6 +5,9 @@ 2007-10-09 David Bateman + * oct-time.cc (octave_strptime::init): Only call mktime if mday is + valud and mon and year are also filled in. + * Array2.h (Array2::Array2(const dim_vector&), Array2::Array(const dim_vector&, const T&)): Check that dim_vector is 2 dimensional. diff -r 3fbf49bde6d4 -r 963878fa3267 liboctave/oct-time.cc --- a/liboctave/oct-time.cc Wed Oct 10 00:21:29 2007 +0000 +++ b/liboctave/oct-time.cc Wed Oct 10 00:33:17 2007 +0000 @@ -356,9 +356,13 @@ char *q = oct_strptime (p, fmt.c_str (), &t); - // Fill in wday and yday. - t.tm_isdst = -1; - mktime (&t); + // Fill in wday and yday, but only if mday is valid and the mon and year + // are filled in, avoiding issues with mktime and invalid dates. + if (t.tm_mday != 0 && t.tm_mon >= 0 && t.tm_year != 0) + { + t.tm_isdst = -1; + mktime (&t); + } if (q) nchars = q - p + 1;