26#if ! defined (octave_oct_time_h)
27#define octave_oct_time_h 1
29#include "octave-config.h"
36as_double (OCTAVE_TIME_T sec,
long usec)
42 return (
static_cast<double> (sec) +
static_cast<double> (usec) / 1.0e6);
56 : m_ot_unix_time (0), m_ot_usec (0) {
stamp (); }
59 : m_ot_unix_time (t), m_ot_usec (0) { }
61 time (OCTAVE_TIME_T t,
long us)
62 : m_ot_unix_time (t), m_ot_usec ()
69 extra = (us -
rem) / 1000000;
75 extra = - (1 + (us -
rem) / 1000000);
76 rem = 1000000 - us % 1000000;
80 m_ot_unix_time += extra;
88 : m_ot_unix_time (ot.m_ot_unix_time), m_ot_usec (ot.m_ot_usec) { }
94 m_ot_unix_time = ot.m_ot_unix_time;
95 m_ot_usec = ot.m_ot_usec;
107 return as_double (m_ot_unix_time, m_ot_usec);
110 OCTAVE_TIME_T
unix_time ()
const {
return m_ot_unix_time; }
112 long usec ()
const {
return m_ot_usec; }
121 OCTAVE_TIME_T m_ot_unix_time;
155 return (t1 < t2 || t1 == t2);
174 return (t1 > t2 || t1 == t2);
253 {
return strftime (
"%a %b %d %H:%M:%S %Y\n"); }
332 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
gmtime)
345 strptime (
const std::string& str,
const std::string& fmt)
351 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
strptime)
359 OCTAVE_API void init (
const std::string& str,
const std::string& fmt);
369 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0)
374 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
cpu_time)
380 return as_double (m_usr_sec, m_usr_usec);
385 return as_double (m_sys_sec, m_sys_usec);
388 OCTAVE_TIME_T
user_sec ()
const {
return m_usr_sec; }
396 OCTAVE_TIME_T m_usr_sec;
397 OCTAVE_TIME_T m_sys_sec;
402 cpu_time (OCTAVE_TIME_T usr_sec, OCTAVE_TIME_T sys_sec,
long usr_usec,
long sys_usec)
403 : m_usr_sec (usr_sec), m_sys_sec (sys_sec),
404 m_usr_usec (usr_usec), m_sys_usec (sys_usec)
413 : m_cpu (), m_maxrss (0), m_ixrss (0), m_idrss (0),
414 m_isrss (0), m_minflt (0), m_majflt (0), m_nswap (0),
415 m_inblock (0), m_oublock (0), m_msgsnd (0), m_msgrcv (0),
416 m_nsignals (0), m_nvcsw (0), m_nivcsw (0)
427 long maxrss ()
const {
return m_maxrss; }
428 long ixrss ()
const {
return m_ixrss; }
429 long idrss ()
const {
return m_idrss; }
430 long isrss ()
const {
return m_isrss; }
431 long minflt ()
const {
return m_minflt; }
432 long majflt ()
const {
return m_majflt; }
433 long nswap ()
const {
return m_nswap; }
436 long msgsnd ()
const {
return m_msgsnd; }
437 long msgrcv ()
const {
return m_msgrcv; }
439 long nvcsw ()
const {
return m_nvcsw; }
440 long nivcsw ()
const {
return m_nivcsw; }
493#if defined (OCTAVE_USE_WINDOWS_API)
495 static OCTAVE_TIME_T time_resolution = 20000000;
498 static OCTAVE_TIME_T time_resolution = 1;
500 return time_resolution;
512 return ! (*
this == t2);
524 return (*
this < t2 || *
this == t2);
536 return (*
this > t2 || *
this == t2);
551 OCTAVE_TIME_T
time ()
const {
return m_time; }
558 OCTAVE_TIME_T m_time;
561OCTAVE_END_NAMESPACE(sys)
562OCTAVE_END_NAMESPACE(octave)
ComplexColumnVector operator+(const ComplexColumnVector &x)
base_tm & operator=(const base_tm &tm)
std::string asctime() const
virtual ~base_tm()=default
std::string strftime(const std::string &fmt) const
base_tm(const base_tm &tm)
OCTAVE_TIME_T user_sec() const
OCTAVE_TIME_T system_sec() const
static file_time time_resolution()
OCTAVE_TIME_T time() const
file_time(const file_time &ot)
file_time(OCTAVE_TIME_T t)
localtime(const localtime &t)
localtime & operator=(const localtime &t)
localtime(const time &ot)
int characters_converted() const
strptime(const std::string &str, const std::string &fmt)
time(OCTAVE_TIME_T t, long us)
time & operator=(const time &ot)
friend std::ostream & operator<<(std::ostream &os, const time &ot)
std::string ctime() const
OCTAVE_TIME_T unix_time() const
double double_value() const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
bool operator!=(const dim_vector &a, const dim_vector &b)
bool operator==(const dim_vector &a, const dim_vector &b)
F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
bool operator!=(const time &t1, const time &t2)
bool operator==(const time &t1, const time &t2)
time operator+(const time &t1, const time &t2)
bool operator>=(const time &t1, const time &t2)
bool operator<(const time &t1, const time &t2)
bool operator<=(const time &t1, const time &t2)
bool operator>(const time &t1, const time &t2)