26 #if ! defined (octave_oct_time_h)
27 #define octave_oct_time_h 1
29 #include "octave-config.h"
41 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) { }
107 return as_double (m_ot_unix_time, m_ot_usec);
110 OCTAVE_TIME_T
unix_time (
void)
const {
return m_ot_unix_time; }
112 long usec (
void)
const {
return m_ot_usec; }
155 return (t1 < t2 || t1 == t2);
174 return (t1 > t2 || t1 == t2);
254 {
return strftime (
"%a %b %d %H:%M:%S %Y\n"); }
353 strptime (
const std::string& str,
const std::string& fmt)
360 :
base_tm (s), m_nchars (s.m_nchars) { }
377 OCTAVE_API void init (
const std::string& str,
const std::string& fmt);
388 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0)
394 : m_usr_sec (tm.m_usr_sec), m_sys_sec (tm.m_sys_sec),
395 m_usr_usec (tm.m_usr_usec), m_sys_usec (tm.m_sys_usec)
415 return as_double (m_usr_sec, m_usr_usec);
420 return as_double (m_sys_sec, m_sys_usec);
423 OCTAVE_TIME_T
user_sec (
void)
const {
return m_usr_sec; }
437 cpu_time (OCTAVE_TIME_T usr_sec, OCTAVE_TIME_T sys_sec,
long usr_usec,
long sys_usec)
438 : m_usr_sec (usr_sec), m_sys_sec (sys_sec),
439 m_usr_usec (usr_usec), m_sys_usec (sys_usec)
template OCTAVE_API std::ostream & operator<<(std::ostream &, const Array< bool > &)
charNDArray min(char d, const charNDArray &m)
virtual ~base_tm(void)=default
std::string asctime(void) const
OCTAVE_API void init(void *p)
std::string zone(void) const
base_tm & operator=(const base_tm &tm)
OCTAVE_API std::string strftime(const std::string &fmt) const
base_tm(const base_tm &tm)
cpu_time(OCTAVE_TIME_T usr_sec, OCTAVE_TIME_T sys_sec, long usr_usec, long sys_usec)
long user_usec(void) const
cpu_time(const cpu_time &tm)
double system(void) const
long system_usec(void) const
OCTAVE_TIME_T user_sec(void) const
OCTAVE_TIME_T system_sec(void) const
localtime(const localtime &t)
localtime(const time &ot)
resource_usage(const resource_usage &ru)
resource_usage & operator=(const resource_usage &ru)
OCTAVE_API void stamp(void)
long nsignals(void) const
strptime(const strptime &s)
strptime(const std::string &str, const std::string &fmt)
int characters_converted(void) const
time(OCTAVE_TIME_T t, long us)
OCTAVE_TIME_T unix_time(void) const
OCTAVE_TIME_T m_ot_unix_time
double double_value(void) const
OCTAVE_BEGIN_NAMESPACE(octave) static octave_value daspk_fcn
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)
static double as_double(OCTAVE_TIME_T sec, long usec)
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)