Mercurial > octave
diff libinterp/corefcn/time.cc @ 21966:112b20240c87
move docstrings in C++ files out of C strings and into comments
* __contourc__.cc, __dispatch__.cc, __dsearchn__.cc, __ichol__.cc,
__ilu__.cc, __lin_interpn__.cc, __luinc__.cc, __magick_read__.cc,
__pchip_deriv__.cc, __qp__.cc, balance.cc, besselj.cc, betainc.cc,
bitfcns.cc, bsxfun.cc, cellfun.cc, colloc.cc, conv2.cc, daspk.cc,
dasrt.cc, dassl.cc, data.cc, debug.cc, defaults.cc, det.cc, dirfns.cc,
dlmread.cc, dot.cc, eig.cc, ellipj.cc, error.cc, fft.cc, fft2.cc,
fftn.cc, file-io.cc, filter.cc, find.cc, gammainc.cc, gcd.cc,
getgrent.cc, getpwent.cc, getrusage.cc, givens.cc, graphics.cc,
hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, kron.cc,
load-path.cc, load-save.cc, lookup.cc, ls-oct-text.cc, lsode.cc,
lu.cc, mappers.cc, matrix_type.cc, max.cc, mgorth.cc, nproc.cc,
oct-hist.cc, octave-link.cc, ordschur.cc, pager.cc, pinv.cc,
pr-output.cc, profiler.cc, psi.cc, pt-jit.cc, quad.cc, quadcc.cc,
qz.cc, rand.cc, rcond.cc, regexp.cc, schur.cc, sighandlers.cc,
sparse.cc, spparms.cc, sqrtm.cc, str2double.cc, strfind.cc, strfns.cc,
sub2ind.cc, svd.cc, sylvester.cc, symtab.cc, syscalls.cc, sysdep.cc,
time.cc, toplev.cc, tril.cc, tsearch.cc, typecast.cc, urlwrite.cc,
utils.cc, variables.cc, __delaunayn__.cc, __eigs__.cc,
__fltk_uigetfile__.cc, __glpk__.cc, __init_fltk__.cc,
__init_gnuplot__.cc, __osmesa_print__.cc, __voronoi__.cc, amd.cc,
audiodevinfo.cc, audioread.cc, ccolamd.cc, chol.cc, colamd.cc,
convhulln.cc, dmperm.cc, fftw.cc, qr.cc, symbfact.cc, symrcm.cc,
ov-base.cc, ov-bool-mat.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc,
ov-fcn-handle.cc, ov-fcn-inline.cc, ov-flt-re-mat.cc, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-java.cc, ov-null-mat.cc,
ov-oncleanup.cc, ov-range.cc, ov-re-mat.cc, ov-struct.cc,
ov-typeinfo.cc, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc,
ov-usr-fcn.cc, ov.cc, octave.cc, pt-arg-list.cc, pt-binop.cc,
pt-eval.cc, pt-mat.cc, lex.ll, oct-parse.in.yy:
Docstrings are now comments instead of C strings.
* build-aux/mk-opts.pl: Emit docstrings as comments instead of C
strings.
* DASPK-opts.in, LSODE-opts.in: Don't quote " in docstring fragments.
* builtins.h: Include builtin-defun-decls.h unconditionally.
* defun.h (DEFUN, DEFUNX, DEFCONSTFUN): Simply emit declaration.
(DEFALIAS): Always expand to nothing.
* defun-dld.h: No special macro expansions for MAKE_BUILTINS.
(DEFUN_DLD): Use FORWARD_DECLARE_FUN.
(DEFUNX_DLD): Use FORWARD_DECLARE_FUNX.
* defun-int.h: No special macro expansions for MAKE_BUILTINS.
(FORWARD_DECLARE_FUN, FORWARD_DECLARE_FUNX): New macros.
(DEFINE_FUN_INSTALLER_FUN): If compiling an Octave source file, pass
"external-doc" to DEFINE_FUNX_INSTALLER_FUN.
(DEFUN_INTERNAL, DEFCONSTFUN_INTERNAL, DEFUNX_INTERNAL,
DEFALIAS_INTERNAL): Delete.
* common.mk (move_if_change_rule): New macro.
(simple_move_if_change_rule): Define using move_if_change_rule.
* find-defun-files.sh (DEFUN_PATTERN): Update. Don't transform file
name extension to ".df".
* libinterp/mk-pkg-add, gendoc.pl: Operate directly on source files.
* mkbuiltins: New argument, SRCDIR. Operate directly on source files.
* mkdefs: Delete.
* libinterp/module.mk (BUILT_SOURCES): Update list to contain only
files included in other source files.
(GENERATED_MAKE_BUILTINS_INCS, DEF_FILES): Delete.
(LIBINTERP_BUILT_DISTFILES): Include $(OPT_HANDLERS) here.
(LIBINTERP_BUILT_NODISTFILES): Not here. Remove $(ALL_DEF_FILES from
the list.
(libinterp_EXTRA_DIST): Remove mkdefs from the list.
(FOUND_DEFUN_FILES): Rename from SRC_DEF_FILES.
(DLDFCN_DEFUN_FILES): Rename from DLDFCN_DEF_FILES.
(SRC_DEFUN_FILES): Rename from SRC_DEF_FILES.
(ALL_DEFUN_FILES): Rename from ALL_DEF_FILES.
(%.df: %.cc): Delete pattern rule.
(libinterp/build-env-features.cc, libinterp/builtins.cc,
libinterp/dldfcn/PKG_ADD): Use mv instead of move-if-change.
(libinterp/builtins.cc, libinterp/builtin-defun-decls.h):
Update mkbuiltins command.
($(srcdir)/libinterp/DOCSTRINGS): Update gendoc.pl command.
* liboctave/module.mk (BUILT_SOURCES): Don't include
liboctave-build-info.cc in the list.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Tue, 21 Jun 2016 16:07:51 -0400 |
parents | b571fc85953f |
children | bac0d6f07a3e |
line wrap: on
line diff
--- a/libinterp/corefcn/time.cc Tue Jun 21 13:08:25 2016 -0700 +++ b/libinterp/corefcn/time.cc Tue Jun 21 16:07:51 2016 -0400 @@ -104,15 +104,15 @@ } DEFUN (time, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {@var{seconds} =} time ()\n\ -Return the current time as the number of seconds since the epoch.\n\ -\n\ -The epoch is referenced to 00:00:00 CUT (Coordinated Universal Time) 1 Jan\n\ -1970. For example, on Monday February 17, 1997 at 07:15:06 CUT, the value\n\ -returned by @code{time} was 856163706.\n\ -@seealso{strftime, strptime, localtime, gmtime, mktime, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {@var{seconds} =} time () +Return the current time as the number of seconds since the epoch. + +The epoch is referenced to 00:00:00 CUT (Coordinated Universal Time) 1 Jan +1970. For example, on Monday February 17, 1997 at 07:15:06 CUT, the value +returned by @code{time} was 856163706. +@seealso{strftime, strptime, localtime, gmtime, mktime, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 0) print_usage (); @@ -127,34 +127,34 @@ */ DEFUN (gmtime, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {@var{tm_struct} =} gmtime (@var{t})\n\ -Given a value returned from @code{time}, or any non-negative integer,\n\ -return a time structure corresponding to CUT (Coordinated Universal Time).\n\ -\n\ -For example:\n\ -\n\ -@example\n\ -@group\n\ -gmtime (time ())\n\ - @result{} @{\n\ - usec = 0\n\ - sec = 6\n\ - min = 15\n\ - hour = 7\n\ - mday = 17\n\ - mon = 1\n\ - year = 97\n\ - wday = 1\n\ - yday = 47\n\ - isdst = 0\n\ - gmtoff = 0\n\ - zone = GMT\n\ - @}\n\ -@end group\n\ -@end example\n\ -@seealso{strftime, strptime, localtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {@var{tm_struct} =} gmtime (@var{t}) +Given a value returned from @code{time}, or any non-negative integer, +return a time structure corresponding to CUT (Coordinated Universal Time). + +For example: + +@example +@group +gmtime (time ()) + @result{} @{ + usec = 0 + sec = 6 + min = 15 + hour = 7 + mday = 17 + mon = 1 + year = 97 + wday = 1 + yday = 47 + isdst = 0 + gmtoff = 0 + zone = GMT + @} +@end group +@end example +@seealso{strftime, strptime, localtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 1) print_usage (); @@ -184,32 +184,32 @@ */ DEFUN (localtime, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {@var{tm_struct} =} localtime (@var{t})\n\ -Given a value returned from @code{time}, or any non-negative integer,\n\ -return a time structure corresponding to the local time zone.\n\ -\n\ -@example\n\ -@group\n\ -localtime (time ())\n\ - @result{} @{\n\ - usec = 0\n\ - sec = 6\n\ - min = 15\n\ - hour = 1\n\ - mday = 17\n\ - mon = 1\n\ - year = 97\n\ - wday = 1\n\ - yday = 47\n\ - isdst = 0\n\ - gmtoff = -21600\n\ - zone = CST\n\ - @}\n\ -@end group\n\ -@end example\n\ -@seealso{strftime, strptime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {@var{tm_struct} =} localtime (@var{t}) +Given a value returned from @code{time}, or any non-negative integer, +return a time structure corresponding to the local time zone. + +@example +@group +localtime (time ()) + @result{} @{ + usec = 0 + sec = 6 + min = 15 + hour = 1 + mday = 17 + mon = 1 + year = 97 + wday = 1 + yday = 47 + isdst = 0 + gmtoff = -21600 + zone = CST + @} +@end group +@end example +@seealso{strftime, strptime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 1) print_usage (); @@ -239,21 +239,21 @@ */ DEFUN (mktime, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {@var{seconds} =} mktime (@var{tm_struct})\n\ -Convert a time structure corresponding to the local time to the number of\n\ -seconds since the epoch.\n\ -\n\ -For example:\n\ -\n\ -@example\n\ -@group\n\ -mktime (localtime (time ()))\n\ - @result{} 856163706\n\ -@end group\n\ -@end example\n\ -@seealso{strftime, strptime, localtime, gmtime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {@var{seconds} =} mktime (@var{tm_struct}) +Convert a time structure corresponding to the local time to the number of +seconds since the epoch. + +For example: + +@example +@group +mktime (localtime (time ())) + @result{} 856163706 +@end group +@end example +@seealso{strftime, strptime, localtime, gmtime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 1) print_usage (); @@ -283,162 +283,162 @@ */ DEFUN (strftime, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {} strftime (@var{fmt}, @var{tm_struct})\n\ -Format the time structure @var{tm_struct} in a flexible way using the format\n\ -string @var{fmt} that contains @samp{%} substitutions similar to those in\n\ -@code{printf}.\n\ -\n\ -Except where noted, substituted fields have a fixed size; numeric fields are\n\ -padded if necessary. Padding is with zeros by default; for fields that\n\ -display a single number, padding can be changed or inhibited by following\n\ -the @samp{%} with one of the modifiers described below. Unknown field\n\ -specifiers are copied as normal characters. All other characters are copied\n\ -to the output without change. For example:\n\ -\n\ -@example\n\ -@group\n\ -strftime (\"%r (%Z) %A %e %B %Y\", localtime (time ()))\n\ - @result{} \"01:15:06 AM (CST) Monday 17 February 1997\"\n\ -@end group\n\ -@end example\n\ -\n\ -Octave's @code{strftime} function supports a superset of the ANSI C field\n\ -specifiers.\n\ -\n\ -@noindent\n\ -Literal character fields:\n\ -\n\ -@table @code\n\ -@item %%\n\ -% character.\n\ -\n\ -@item %n\n\ -Newline character.\n\ -\n\ -@item %t\n\ -Tab character.\n\ -@end table\n\ -\n\ -@noindent\n\ -Numeric modifiers (a nonstandard extension):\n\ -\n\ -@table @code\n\ -@item - (dash)\n\ -Do not pad the field.\n\ -\n\ -@item _ (underscore)\n\ -Pad the field with spaces.\n\ -@end table\n\ -\n\ -@noindent\n\ -Time fields:\n\ -\n\ -@table @code\n\ -@item %H\n\ -Hour (00-23).\n\ -\n\ -@item %I\n\ -Hour (01-12).\n\ -\n\ -@item %k\n\ -Hour (0-23).\n\ -\n\ -@item %l\n\ -Hour (1-12).\n\ -\n\ -@item %M\n\ -Minute (00-59).\n\ -\n\ -@item %p\n\ -Locale's AM or PM.\n\ -\n\ -@item %r\n\ -Time, 12-hour (hh:mm:ss [AP]M).\n\ -\n\ -@item %R\n\ -Time, 24-hour (hh:mm).\n\ -\n\ -@item %s\n\ -Time in seconds since 00:00:00, Jan 1, 1970 (a nonstandard extension).\n\ -\n\ -@item %S\n\ -Second (00-61).\n\ -\n\ -@item %T\n\ -Time, 24-hour (hh:mm:ss).\n\ -\n\ -@item %X\n\ -Locale's time representation (%H:%M:%S).\n\ -\n\ -@item %z\n\ -Offset from UTC (±@nospell{hhmm}), or nothing if no time zone is\n\ -determinable.\n\ -\n\ -@item %Z\n\ -Time zone (EDT), or nothing if no time zone is determinable.\n\ -@end table\n\ -\n\ -@noindent\n\ -Date fields:\n\ -\n\ -@table @code\n\ -@item %a\n\ -Locale's abbreviated weekday name (Sun-Sat).\n\ -\n\ -@item %A\n\ -Locale's full weekday name, variable length (Sunday-Saturday).\n\ -\n\ -@item %b\n\ -Locale's abbreviated month name (Jan-Dec).\n\ -\n\ -@item %B\n\ -Locale's full month name, variable length (January-December).\n\ -\n\ -@item %c\n\ -Locale's date and time (Sat Nov 04 12:02:33 EST 1989).\n\ -\n\ -@item %C\n\ -Century (00-99).\n\ -\n\ -@item %d\n\ -Day of month (01-31).\n\ -\n\ -@item %e\n\ -Day of month ( 1-31).\n\ -\n\ -@item %D\n\ -Date (mm/dd/yy).\n\ -\n\ -@item %h\n\ -Same as %b.\n\ -\n\ -@item %j\n\ -Day of year (001-366).\n\ -\n\ -@item %m\n\ -Month (01-12).\n\ -\n\ -@item %U\n\ -Week number of year with Sunday as first day of week (00-53).\n\ -\n\ -@item %w\n\ -Day of week (0-6).\n\ -\n\ -@item %W\n\ -Week number of year with Monday as first day of week (00-53).\n\ -\n\ -@item %x\n\ -Locale's date representation (mm/dd/yy).\n\ -\n\ -@item %y\n\ -Last two digits of year (00-99).\n\ -\n\ -@item %Y\n\ -Year (1970-).\n\ -@end table\n\ -@seealso{strptime, localtime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {} strftime (@var{fmt}, @var{tm_struct}) +Format the time structure @var{tm_struct} in a flexible way using the format +string @var{fmt} that contains @samp{%} substitutions similar to those in +@code{printf}. + +Except where noted, substituted fields have a fixed size; numeric fields are +padded if necessary. Padding is with zeros by default; for fields that +display a single number, padding can be changed or inhibited by following +the @samp{%} with one of the modifiers described below. Unknown field +specifiers are copied as normal characters. All other characters are copied +to the output without change. For example: + +@example +@group +strftime ("%r (%Z) %A %e %B %Y", localtime (time ())) + @result{} "01:15:06 AM (CST) Monday 17 February 1997" +@end group +@end example + +Octave's @code{strftime} function supports a superset of the ANSI C field +specifiers. + +@noindent +Literal character fields: + +@table @code +@item %% +% character. + +@item %n +Newline character. + +@item %t +Tab character. +@end table + +@noindent +Numeric modifiers (a nonstandard extension): + +@table @code +@item - (dash) +Do not pad the field. + +@item _ (underscore) +Pad the field with spaces. +@end table + +@noindent +Time fields: + +@table @code +@item %H +Hour (00-23). + +@item %I +Hour (01-12). + +@item %k +Hour (0-23). + +@item %l +Hour (1-12). + +@item %M +Minute (00-59). + +@item %p +Locale's AM or PM. + +@item %r +Time, 12-hour (hh:mm:ss [AP]M). + +@item %R +Time, 24-hour (hh:mm). + +@item %s +Time in seconds since 00:00:00, Jan 1, 1970 (a nonstandard extension). + +@item %S +Second (00-61). + +@item %T +Time, 24-hour (hh:mm:ss). + +@item %X +Locale's time representation (%H:%M:%S). + +@item %z +Offset from UTC (±@nospell{hhmm}), or nothing if no time zone is +determinable. + +@item %Z +Time zone (EDT), or nothing if no time zone is determinable. +@end table + +@noindent +Date fields: + +@table @code +@item %a +Locale's abbreviated weekday name (Sun-Sat). + +@item %A +Locale's full weekday name, variable length (Sunday-Saturday). + +@item %b +Locale's abbreviated month name (Jan-Dec). + +@item %B +Locale's full month name, variable length (January-December). + +@item %c +Locale's date and time (Sat Nov 04 12:02:33 EST 1989). + +@item %C +Century (00-99). + +@item %d +Day of month (01-31). + +@item %e +Day of month ( 1-31). + +@item %D +Date (mm/dd/yy). + +@item %h +Same as %b. + +@item %j +Day of year (001-366). + +@item %m +Month (01-12). + +@item %U +Week number of year with Sunday as first day of week (00-53). + +@item %w +Day of week (0-6). + +@item %W +Week number of year with Monday as first day of week (00-53). + +@item %x +Locale's date representation (mm/dd/yy). + +@item %y +Last two digits of year (00-99). + +@item %Y +Year (1970-). +@end table +@seealso{strptime, localtime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 2) print_usage (); @@ -466,16 +466,16 @@ */ DEFUN (strptime, args, , - "-*- texinfo -*-\n\ -@deftypefn {} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @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, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ -@end deftypefn") + doc: /* -*- texinfo -*- +@deftypefn {} {[@var{tm_struct}, @var{nchars}] =} strptime (@var{str}, @var{fmt}) +Convert the string @var{str} to the time structure @var{tm_struct} under +the control of the format string @var{fmt}. + +If @var{fmt} fails to match, @var{nchars} is 0; otherwise, it is set to the +position of last matched character plus 1. Always check for this unless +you're absolutely sure the date string will be parsed correctly. +@seealso{strftime, localtime, gmtime, mktime, time, now, date, clock, datenum, datestr, datevec, calendar, weekday} +@end deftypefn */) { if (args.length () != 2) print_usage ();