Mercurial > hg > octave-max
changeset 6995:963878fa3267
[project @ 2007-10-10 00:33:17 by jwe]
author | jwe |
---|---|
date | Wed, 10 Oct 2007 00:33:17 +0000 |
parents | 3fbf49bde6d4 |
children | 9861dc5f382b |
files | liboctave/ChangeLog liboctave/oct-time.cc |
diffstat | 2 files changed, 10 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -5,6 +5,9 @@ 2007-10-09 David Bateman <dbateman@free.fr> + * oct-time.cc (octave_strptime::init): Only call mktime if mday is + valud and mon and year are also filled in. + * Array2.h (Array2<T>::Array2(const dim_vector&), Array2<T>::Array(const dim_vector&, const T&)): Check that dim_vector is 2 dimensional.
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -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;