#include <string>
#include "defun-dld.h"
#include "error.h"
#include "oct-map.h"
#include "oct-time.h"
#include "ov.h"
#include "oct-obj.h"
Go to the source code of this file.
Functions | |
DEFUN_DLD (time, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{seconds} =} time ()\n\ Return the current time as the number of seconds since the epoch. The\n\ 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\n\ value returned by @code{time} was 856163706.\n\ @seealso{strftime, strptime, localtime, gmtime, mktime, now, date, clock, datenum, datestr, datevec, calendar, weekday}\n\ @end deftypefn") | |
DEFUN_DLD (mktime, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@var{seconds} =} mktime (@var{tm_struct})\n\ Convert a time structure corresponding to the local time to the number\n\ of seconds since the epoch. 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") | |
DEFUN_DLD (strftime, args,,"-*- texinfo -*-\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\ number, padding can be changed or inhibited by following the @samp{%}\n\ with one of the modifiers described below. Unknown field specifiers are\n\ copied as normal characters. All other characters are copied to the\n\ 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\n\ field 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\ 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") | |
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 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") | |
DEFUN_DLD (localtime, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@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\ 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") | |
DEFUN_DLD (gmtime, args,,"-*- texinfo -*-\n\ @deftypefn {Loadable Function} {@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\ 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\ zone = CST\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") | |
static octave_base_tm | extract_tm (const octave_scalar_map &m) |
static int | intfield (const octave_scalar_map &m, const std::string &k) |
static octave_scalar_map | mk_tm_map (const octave_base_tm &t) |
static std::string | stringfield (const octave_scalar_map &m, const std::string &k) |
DEFUN_DLD | ( | time | , | |
args | ||||
) |
Definition at line 104 of file time.cc.
References print_usage().
DEFUN_DLD | ( | mktime | , | |
args | ||||
) |
Definition at line 259 of file time.cc.
References error(), error_state, extract_tm(), and print_usage().
DEFUN_DLD | ( | strftime | , | |
args | ||||
) |
Definition at line 316 of file time.cc.
References error(), error_state, extract_tm(), print_usage(), and octave_base_tm::strftime().
DEFUN_DLD | ( | strptime | , | |
args | ||||
) |
Definition at line 514 of file time.cc.
References octave_strptime::characters_converted(), error(), error_state, mk_tm_map(), octave_value(), and print_usage().
DEFUN_DLD | ( | localtime | , | |
args | ||||
) |
Definition at line 195 of file time.cc.
References error_state, mk_tm_map(), octave_value(), and print_usage().
DEFUN_DLD | ( | gmtime | , | |
args | ||||
) |
Definition at line 130 of file time.cc.
References error_state, mk_tm_map(), octave_value(), and print_usage().
static octave_base_tm extract_tm | ( | const octave_scalar_map & | m | ) | [static] |
Definition at line 85 of file time.cc.
References octave_base_tm::hour(), intfield(), octave_base_tm::isdst(), octave_base_tm::mday(), octave_base_tm::min(), octave_base_tm::mon(), octave_base_tm::sec(), stringfield(), octave_base_tm::usec(), octave_base_tm::wday(), octave_base_tm::yday(), octave_base_tm::year(), and octave_base_tm::zone().
Referenced by DEFUN_DLD().
static int intfield | ( | const octave_scalar_map & | m, | |
const std::string & | k | |||
) | [inline, static] |
Definition at line 59 of file time.cc.
References octave_scalar_map::getfield(), octave_value::int_value(), and octave_value::is_empty().
Referenced by extract_tm().
static octave_scalar_map mk_tm_map | ( | const octave_base_tm & | t | ) | [static] |
Definition at line 39 of file time.cc.
References octave_scalar_map::assign(), octave_base_tm::hour(), octave_base_tm::isdst(), octave_base_tm::mday(), octave_base_tm::min(), octave_base_tm::mon(), octave_base_tm::sec(), octave_base_tm::usec(), octave_base_tm::wday(), octave_base_tm::yday(), octave_base_tm::year(), and octave_base_tm::zone().
Referenced by DEFUN_DLD().
static std::string stringfield | ( | const octave_scalar_map & | m, | |
const std::string & | k | |||
) | [inline, static] |
Definition at line 72 of file time.cc.
References octave_scalar_map::getfield(), octave_value::is_empty(), and octave_value::string_value().
Referenced by extract_tm().