23 #if ! defined (octave_oct_time_h) 24 #define octave_oct_time_h 1 26 #include "octave-config.h" 40 return (static_cast<double> (sec) + static_cast<double> (usec) / 1.0e6);
56 : ot_unix_time (0), ot_usec (0) { stamp (); }
59 : ot_unix_time (
t), ot_usec (0) { }
62 : ot_unix_time (
t), ot_usec ()
69 extra = (us -
rem) / 1000000;
75 extra = - (1 + (us -
rem) / 1000000);
76 rem = 1000000 - us % 1000000;
80 ot_unix_time += extra;
88 : ot_unix_time (ot.ot_unix_time), ot_usec (ot.ot_usec) { }
101 ~
time (
void) =
default;
107 return as_double (ot_unix_time, ot_usec);
112 long usec (
void)
const {
return ot_usec; }
155 return (t1 < t2 || t1 == t2);
174 return (t1 > t2 || t1 == t2);
191 : m_usec (0), m_sec (0), m_min (0), m_hour (0),
192 m_mday (0), m_mon (0), m_year (0), m_wday (0),
193 m_yday (0), m_isdst (0), m_gmtoff (0), m_zone (
"unknown")
197 : m_usec (tm.m_usec), m_sec (tm.m_sec), m_min (tm.m_min),
198 m_hour (tm.m_hour), m_mday (tm.m_mday), m_mon (tm.m_mon),
199 m_year (tm.m_year), m_wday (tm.m_wday), m_yday (tm.m_yday),
200 m_isdst (tm.m_isdst), m_gmtoff (tm.m_gmtoff), m_zone (tm.m_zone)
224 virtual ~
base_tm (
void) =
default;
226 int usec (
void)
const {
return m_usec; }
227 int sec (
void)
const {
return m_sec; }
228 int min (
void)
const {
return m_min; }
229 int hour (
void)
const {
return m_hour; }
230 int mday (
void)
const {
return m_mday; }
231 int mon (
void)
const {
return m_mon; }
232 int year (
void)
const {
return m_year; }
233 int wday (
void)
const {
return m_wday; }
234 int yday (
void)
const {
return m_yday; }
235 int isdst (
void)
const {
return m_isdst; }
236 long gmtoff (
void)
const {
return m_gmtoff; }
255 {
return strftime (
"%a %b %d %H:%M:%S %Y\n"); }
323 void init (
const time& ot);
348 void init (
const time& ot);
393 : m_usr_sec (0), m_sys_sec (0), m_usr_usec (0), m_sys_usec (0)
399 : m_usr_sec (tm.m_usr_sec), m_sys_sec (tm.m_sys_sec),
400 m_usr_usec (tm.m_usr_usec), m_sys_usec (tm.m_sys_usec)
420 return as_double (m_usr_sec, m_usr_usec);
425 return as_double (m_sys_sec, m_sys_usec);
442 cpu_time (time_t usr_sec, time_t sys_sec,
long usr_usec,
long sys_usec)
443 : m_usr_sec (usr_sec), m_sys_sec (sys_sec),
444 m_usr_usec (usr_usec), m_sys_usec (sys_usec)
454 : m_cpu (), m_maxrss (0), m_ixrss (0), m_idrss (0),
455 m_isrss (0), m_minflt (0), m_majflt (0), m_nswap (0),
456 m_inblock (0), m_oublock (0), m_msgsnd (0), m_msgrcv (0),
457 m_nsignals (0), m_nvcsw (0), m_nivcsw (0)
463 : m_cpu (ru.m_cpu), m_maxrss (ru.m_maxrss),
464 m_ixrss (ru.m_ixrss), m_idrss (ru.m_idrss),
465 m_isrss (ru.m_isrss), m_minflt (ru.m_minflt),
466 m_majflt (ru.m_majflt), m_nswap (ru.m_nswap),
467 m_inblock (ru.m_inblock), m_oublock (ru.m_oublock),
468 m_msgsnd (ru.m_msgsnd), m_msgrcv (ru.m_msgrcv),
469 m_nsignals (ru.m_nsignals), m_nvcsw (ru.m_nvcsw),
470 m_nivcsw (ru.m_nivcsw)
502 long maxrss (
void)
const {
return m_maxrss; }
503 long ixrss (
void)
const {
return m_ixrss; }
504 long idrss (
void)
const {
return m_idrss; }
505 long isrss (
void)
const {
return m_isrss; }
506 long minflt (
void)
const {
return m_minflt; }
507 long majflt (
void)
const {
return m_majflt; }
508 long nswap (
void)
const {
return m_nswap; }
509 long inblock (
void)
const {
return m_inblock; }
510 long oublock (
void)
const {
return m_oublock; }
511 long msgsnd (
void)
const {
return m_msgsnd; }
512 long msgrcv (
void)
const {
return m_msgrcv; }
514 long nvcsw (
void)
const {
return m_nvcsw; }
515 long nivcsw (
void)
const {
return m_nivcsw; }
539 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) 541 OCTAVE_DEPRECATED (4.2,
"use 'octave::sys::time' instead")
542 typedef
octave::sys::time octave_time;
544 OCTAVE_DEPRECATED (4.2, "use '
octave::sys::base_tm'
instead")
545 typedef
octave::sys::base_tm octave_base_tm;
547 OCTAVE_DEPRECATED (4.2, "use '
octave::sys::localtime'
instead")
548 typedef
octave::sys::localtime octave_localtime;
551 typedef
octave::sys::gmtime octave_gmtime;
553 OCTAVE_DEPRECATED (4.2, "use '
octave::sys::strptime'
instead")
554 typedef
octave::sys::strptime octave_strptime;
for fields that display a single padding can be changed or inhibited by following the hour(hh:mm:ss [AP]M). tem %R Time
std::ostream & operator<<(std::ostream &os, const time &ot)
std::string asctime(void) const
cpu_time(const cpu_time &tm)
bool operator!=(const time &t1, const time &t2)
bool operator<=(const time &t1, const time &t2)
long user_usec(void) const
long system_usec(void) const
bool operator>=(const time &t1, const time &t2)
cpu_time(time_t usr_sec, time_t sys_sec, long usr_usec, long sys_usec)
bool operator==(const time &t1, const time &t2)
base_tm(const base_tm &tm)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE * d
static double as_double(time_t sec, long usec)
bool operator>(const time &t1, const time &t2)
localtime(const time &ot)
double double_value(void) const
std::string zone(void) const
time_t user_sec(void) const
int characters_converted(void) const
resource_usage(const resource_usage &ru)
base_tm & operator=(const base_tm &tm)
time_t unix_time(void) const
time_t system_sec(void) const
strptime(const std::string &str, const std::string &fmt)
bool operator<(const time &t1, const time &t2)
time operator+(const time &t1, const time &t2)
localtime(const localtime &t)
octave_int< T > rem(const octave_int< T > &x, const octave_int< T > &y)
double system(void) const
long nsignals(void) const
strptime(const strptime &s)
If this string is the system will ring the terminal sometimes it is useful to be able to print the original representation of the string
charNDArray min(char d, const charNDArray &m)