# HG changeset patch # User jwe # Date 1142481549 0 # Node ID c5f6623514c4780410752e15f38be95cb635f80e # Parent 86adc85cc471c98da332632355aa3e9c0830691c [project @ 2006-03-16 03:59:09 by jwe] diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog --- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,7 @@ +2006-03-15 William Poetra Yoga Hadisoeseno + + * oct-time.cc (octave_strptime::init): Return useful character count. + 2006-03-08 David Bateman * SparseCmplxQR.cc: Updates for new upstream CXSPARSE release. Fix for diff --git a/liboctave/oct-time.cc b/liboctave/oct-time.cc --- 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; diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2006-03-15 William Poetra Yoga Hadisoeseno - * 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 diff --git a/src/DLD-FUNCTIONS/time.cc b/src/DLD-FUNCTIONS/time.cc --- 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;