Mercurial > hg > octave-nkf
changeset 5675:c5f6623514c4
[project @ 2006-03-16 03:59:09 by jwe]
author | jwe |
---|---|
date | Thu, 16 Mar 2006 03:59:09 +0000 |
parents | 86adc85cc471 |
children | 9c9eac3a6513 |
files | liboctave/ChangeLog liboctave/oct-time.cc src/ChangeLog src/DLD-FUNCTIONS/time.cc |
diffstat | 4 files changed, 22 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2006-03-15 William Poetra Yoga Hadisoeseno <williampoetra@gmail.com> + + * oct-time.cc (octave_strptime::init): Return useful character count. + 2006-03-08 David Bateman <dbateman@free.fr> * SparseCmplxQR.cc: Updates for new upstream CXSPARSE release. Fix for
--- a/liboctave/oct-time.cc +++ b/liboctave/oct-time.cc @@ -347,7 +347,10 @@ char *q = oct_strptime (p, fmt.c_str (), &t); - nchars = p - q; + if (q) + nchars = q - p + 1; + else + nchars = 0; delete [] p;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2006-03-15 William Poetra Yoga Hadisoeseno <williampoetra@gmail.com> - * src/strfns.cc: Fixed help message. + * DLD-FUNCTIONS/time.cc (Fstrptime, Fstrftime): Fix docstring. + + * strfns.cc (Fstrcmp): Fixed docstring. 2006-03-15 John W. Eaton <jwe@octave.org>
--- a/src/DLD-FUNCTIONS/time.cc +++ b/src/DLD-FUNCTIONS/time.cc @@ -217,8 +217,9 @@ DEFUN_DLD (strftime, args, , "-*- texinfo -*-\n\ -@deftypefn {Loadable Function} {} strftime (@var{tm_struct})\n\ -Format a time structure in a flexible way using @samp{%} substitutions\n\ +@deftypefn {Loadable Function} {} strftime (@var{fmt}, @var{tm_struct})\n\ +Format the time structure @var{tm_struct} in a flexible way using the\n\ +format string @var{fmt} that contains @samp{%} substitutions\n\ similar to those in @code{printf}. Except where noted, substituted\n\ fields have a fixed size; numeric fields are padded if necessary.\n\ Padding is with zeros by default; for fields that display a single\n\ @@ -364,6 +365,7 @@ @item %Y\n\ Year (1970-).\n\ @end table\n\ +@seealso{strptime, localtime, time}\n\ @end deftypefn") { octave_value retval; @@ -400,8 +402,13 @@ DEFUN_DLD (strptime, args, , "-*- texinfo -*-\n\ @deftypefn {Loadable Function} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @var{fmt})\n\ -Convert the string @var{str} to a time structure under the control of\n\ -the format @var{fmt}.\n\ +Convert the string @var{str} to the time structure @var{tm_struct} under\n\ +the control of the format string @var{fmt}.\n\ +\n\ +If @var{fmt} fails to match, @var{nchars} is 0; otherwise it is set to the\n\ +position of last matched character plus 1. Always check for this unless\n\ +you're absolutely sure the date string will be parsed correctly.\n\ +@seealso{strftime, localtime, time}\n\ @end deftypefn") { octave_value_list retval;