Mercurial > hg > octave-terminal
changeset 6996:9861dc5f382b
[project @ 2007-10-10 00:39:21 by jwe]
author | jwe |
---|---|
date | Wed, 10 Oct 2007 00:39:22 +0000 |
parents | 963878fa3267 |
children | 6d0d8d621532 |
files | liboctave/ChangeLog liboctave/oct-time.cc |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,5 +1,9 @@ 2007-10-09 John W. Eaton <jwe@octave.org> + * oct-time.cc (octave_strptime::init): Initialize t.tm_mon to -1 + and t.tm_year to INT_MIN before call to oct_strptime. Adjust + values to zero after call if they remain unchanged. + * dSparse.cc (SparseMatrix::all_elements_are_zero): New function. * dNDArray.cc (NDArray::all_elements_are_zero): New function.
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -341,8 +341,8 @@ t.tm_min = 0; t.tm_hour = 0; t.tm_mday = 0; - t.tm_mon = 0; - t.tm_year = 0; + t.tm_mon = -1; + t.tm_year = INT_MIN; t.tm_wday = 0; t.tm_yday = 0; t.tm_isdst = 0; @@ -358,12 +358,18 @@ // 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) + if (t.tm_mday != 0 && t.tm_mon >= 0 && t.tm_year != INT_MIN) { t.tm_isdst = -1; mktime (&t); } + if (t.tm_mon < 0) + t.tm_mon = 0; + + if (t.tm_year == INT_MIN) + t.tm_year = 0; + if (q) nchars = q - p + 1; else