26 #if defined (HAVE_CONFIG_H)
48 m.assign (
"usec",
static_cast<double> (t.usec ()));
49 m.assign (
"sec",
static_cast<double> (t.sec ()));
50 m.assign (
"min",
static_cast<double> (t.min ()));
51 m.assign (
"hour",
static_cast<double> (t.hour ()));
52 m.assign (
"mday",
static_cast<double> (t.mday ()));
53 m.assign (
"mon",
static_cast<double> (t.mon ()));
54 m.assign (
"year",
static_cast<double> (t.year ()));
55 m.assign (
"wday",
static_cast<double> (t.wday ()));
56 m.assign (
"yday",
static_cast<double> (t.yday ()));
57 m.assign (
"isdst",
static_cast<double> (t.isdst ()));
58 m.assign (
"gmtoff",
static_cast<double> (t.gmtoff ()));
59 m.assign (
"zone", t.zone ());
72 retval = v.
xint_value (
"%s: invalid TM_STRUCT argument", who);
77 static inline std::string
85 retval = v.
xstring_value (
"%s: invalid TM_STRUCT argument", who);
123 if (args.length () != 0)
126 return ovl (sys::time ());
166 if (args.length () != 1 || args(0).
numel () != 1)
169 double tmp = args(0).double_value ();
222 if (args.length () != 1 || args(0).
numel () != 1)
225 double tmp = args(0).double_value ();
249 DEFUN (mktime, args, ,
267 if (args.length () != 1)
271 0).xscalar_map_value (
"mktime: TM_STRUCT argument must be a structure");
275 return ovl (sys::time (tm));
295 DEFUN (strftime, args, ,
454 if (args.length () != 2)
457 std::string fmt = args(0).xstring_value (
"strftime: FMT must be a string");
459 octave_scalar_map map = args(1).xscalar_map_value (
"strftime: TM_STRUCT must be a structure");
461 sys::base_tm tm =
extract_tm (map,
"strftime");
463 return ovl (tm.strftime (fmt));
492 if (args.length () != 2)
495 std::string str = args(0).xstring_value (
"strptime: argument STR must be a string");
497 std::string fmt = args(1).xstring_value (
"strptime: FMT must be a string");
499 sys::strptime t (str, fmt);
OCTINTERP_API std::string xstring_value(const char *fmt,...) const
OCTINTERP_API int xint_value(const char *fmt,...) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
OCTINTERP_API void print_usage(void)
#define DEFUN(name, args_name, nargout_name, doc)
Macro to define a builtin function.
T::size_type numel(const T &str)
octave_value_list ovl(const OV_Args &... args)
Construct an octave_value_list with less typing.
static std::string stringfield(const octave_scalar_map &m, const std::string &k, const char *who)
static int intfield(const octave_scalar_map &m, const std::string &k, const char *who)
static octave_scalar_map mk_tm_map(const sys::base_tm &t)
static sys::base_tm extract_tm(const octave_scalar_map &m, const char *who)