26 #if ! defined (octave_oct_time_h)
27 #define octave_oct_time_h 1
29 #include "octave-config.h"
34 #if defined (OCTAVE_USE_WINDOWS_API)
38 struct OCTAVE_WIN_FILETIME
40 uint32_t dwLowDateTime;
41 uint32_t dwHighDateTime;
47 as_double (OCTAVE_TIME_T sec,
long usec)
53 return (
static_cast<double> (sec) +
static_cast<double> (usec) / 1.0e6);
68 : m_ot_unix_time (0), m_ot_usec (0) { stamp (); }
71 : m_ot_unix_time (t), m_ot_usec (0) { }
73 time (OCTAVE_TIME_T t,
long us)
74 : m_ot_unix_time (t), m_ot_usec ()
81 extra = (us -
rem) / 1000000;
87 extra = - (1 + (us -
rem) / 1000000);
88 rem = 1000000 - us % 1000000;
92 m_ot_unix_time += extra;
100 : m_ot_unix_time (ot.m_ot_unix_time), m_ot_usec (ot.m_ot_usec) { }
106 m_ot_unix_time = ot.m_ot_unix_time;
107 m_ot_usec = ot.m_ot_usec;
119 return as_double (m_ot_unix_time, m_ot_usec);
122 OCTAVE_TIME_T
unix_time ()
const {
return m_ot_unix_time; }
124 long usec ()
const {
return m_ot_usec; }
133 OCTAVE_TIME_T m_ot_unix_time;
167 return (t1 < t2 || t1 == t2);
186 return (t1 > t2 || t1 == t2);
266 {
return strftime (
"%a %b %d %H:%M:%S %Y\n"); }
347 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
gmtime)
361 strptime (
const std::string& str,
const std::string& fmt)
367 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
strptime)
369 int characters_converted ()
const {
return m_nchars; }
375 OCTAVE_API void init (
const std::string& str,
const std::string& fmt);
386 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0)
391 OCTAVE_DEFAULT_COPY_MOVE_DELETE (
cpu_time)
397 return as_double (m_usr_sec, m_usr_usec);
402 return as_double (m_sys_sec, m_sys_usec);
405 OCTAVE_TIME_T
user_sec ()
const {
return m_usr_sec; }
413 OCTAVE_TIME_T m_usr_sec;
414 OCTAVE_TIME_T m_sys_sec;
419 cpu_time (OCTAVE_TIME_T usr_sec, OCTAVE_TIME_T sys_sec,
long usr_usec,
long sys_usec)
420 : m_usr_sec (usr_sec), m_sys_sec (sys_sec),
421 m_usr_usec (usr_usec), m_sys_usec (sys_usec)
431 : m_cpu (), m_maxrss (0), m_ixrss (0), m_idrss (0),
432 m_isrss (0), m_minflt (0), m_majflt (0), m_nswap (0),
433 m_inblock (0), m_oublock (0), m_msgsnd (0), m_msgrcv (0),
434 m_nsignals (0), m_nvcsw (0), m_nivcsw (0)
445 long maxrss ()
const {
return m_maxrss; }
446 long ixrss ()
const {
return m_ixrss; }
447 long idrss ()
const {
return m_idrss; }
448 long isrss ()
const {
return m_isrss; }
449 long minflt ()
const {
return m_minflt; }
450 long majflt ()
const {
return m_majflt; }
451 long nswap ()
const {
return m_nswap; }
454 long msgsnd ()
const {
return m_msgsnd; }
455 long msgrcv ()
const {
return m_msgrcv; }
457 long nvcsw ()
const {
return m_nvcsw; }
458 long nivcsw ()
const {
return m_nivcsw; }
492 #if defined (OCTAVE_USE_WINDOWS_API)
495 m_time = (
static_cast<OCTAVE_TIME_T
> (t.dwHighDateTime)) >> 32
519 #if defined (OCTAVE_USE_WINDOWS_API)
521 static OCTAVE_TIME_T time_resolution = 20000;
524 static OCTAVE_TIME_T time_resolution = 1;
526 return time_resolution;
538 return ! (*
this == t2);
550 return (*
this < t2 || *
this == t2);
562 return (*
this > t2 || *
this == t2);
577 OCTAVE_TIME_T
time ()
const {
return m_time; }
584 OCTAVE_TIME_T m_time;
587 OCTAVE_END_NAMESPACE(sys)
588 OCTAVE_END_NAMESPACE(
octave)
template std::ostream & operator<<(std::ostream &, const Array< bool > &)
charNDArray min(char d, const charNDArray &m)
std::string asctime() const
base_tm & operator=(const base_tm &tm)
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(const time &ot)
strptime(const std::string &str, const std::string &fmt)
time(OCTAVE_TIME_T t, long us)
OCTAVE_TIME_T unix_time() const
double double_value() 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)
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)