Mercurial > hg > octave-lyh
changeset 3736:ac4609ffc702
[project @ 2000-11-16 17:25:34 by jwe]
author | jwe |
---|---|
date | Thu, 16 Nov 2000 17:25:35 +0000 |
parents | cf69dbe17e59 |
children | b736f8b8f0a1 |
files | liboctave/ChangeLog liboctave/oct-time.cc |
diffstat | 2 files changed, 29 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2000-11-16 Paul Kienzle <pkienzle@kienzle.powernet.co.uk> + + * oct-time.cc (DEFINE_SET_INT_FIELD_FCN): Don't check limits here, + since mktime is supposed to `normalize' the results for us. + 2000-10-31 Paul Kienzle <pkienzle@kienzle.powernet.co.uk> * Array2.cc (Array2<T>::transpose): Avoid copy for empty matrices
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -97,6 +97,20 @@ #endif } +// From the mktime() manual page: +// +// The mktime() function converts a broken-down time structure, +// expressed as local time, to calendar time representation. +// +// <snip> +// +// If structure members are outside their legal interval, they +// will be normalized (so that, e.g., 40 October is changed into +// 9 November). +// +// So, we no longer check limits here. + +#if 0 #define DEFINE_SET_INT_FIELD_FCN(f, lo, hi) \ octave_base_tm& \ octave_base_tm::f (int v) \ @@ -109,6 +123,16 @@ \ return *this; \ } +#else +#define DEFINE_SET_INT_FIELD_FCN(f, lo, hi) \ + octave_base_tm& \ + octave_base_tm::f (int v) \ + { \ + tm_ ## f = v; \ + \ + return *this; \ + } +#endif DEFINE_SET_INT_FIELD_FCN (usec, 0, 1000000) DEFINE_SET_INT_FIELD_FCN (sec, 0, 61)