📄 wytimespec.3wy
字号:
.\".\" Edited by I.J.Wang, 2004.\".TH WyTimeSpec 3wy "libwy v0.31".SH NAMEWyTimeSpec \- class of interval time.SH SYNOPSIS.B #include <wytimespec.h>.PPWyTimeSpec is a discardable class of fixed point number intended to bea converted version for struct \fBtimespec\fP, representing either historicaltime or interval time. The minimal value is one of a billion.Value range checking is provided.Applications can get the system time by Wy::now(), set thesystem time by Wy::set_systime(..). Wy::_mkstr(..) converts value of WyTimeSpec to text string.Wy::_strnum(..) provides finer conversion from string to WyTimeSpec.Note: \fBWy_Second\fP is a typedef of std::time_t, \fBWy_Nano\fP is a typedef of signed long int. .SH "PUBLIC MEMBERS" class \fBReply\fP : public WyRet \fBWyTimeSpec\fP() throw() \fBWyTimeSpec\fP(const WyTimeSpec&) throw() \fBWyTimeSpec\fP(Wy_Second,Wy_Nano) throw(Reply) \fBWyTimeSpec\fP(const WyCSeg&) throw(Reply) \fBWyTimeSpec\fP(WyTimeSpec&, Wy::ByMove_t) throw() bool \fBis_default\fP(void) const throw() Wy_Second \fBsecond\fP(void) const throw() Wy_Nano \fBnano\fP(void) const throw() void \fBreset\fP(void) throw() void \fBreset\fP(const WyTimeSpec&) throw() WyRet \fBreset\fP(Wy_Second,Wy_Nano) throw() WyRet \fBreset\fP(const WyCSeg&) throw() void \fBswap\fP(WyTimeSpec&) throw() WyTimeSpec& \fBoperator =\fP(const WyTimeSpec&) throw() WyTimeSpec& \fBoperator =\fP(const WyCSeg&) throw(Reply) const WyTimeSpec \fBoperator -\fP() const throw(Reply) WyTimeSpec& \fBoperator ++\fP() throw(Reply) WyTimeSpec& \fBoperator --\fP() throw(Reply) const WyTimeSpec \fBoperator ++\fP(int) throw(Reply) const WyTimeSpec \fBoperator --\fP(int) throw(Reply) WyTimeSpec& \fBoperator +=\fP(const WyTimeSpec&) throw(Reply) WyTimeSpec& \fBoperator -=\fP(const WyTimeSpec&) throw(Reply) const WyTimeSpec \fBoperator +\fP(const WyTimeSpec&) const throw(Reply) const WyTimeSpec \fBoperator -\fP(const WyTimeSpec&) const throw(Reply) bool \fBoperator ==\fP(const WyTimeSpec&) const throw() bool \fBoperator !=\fP(const WyTimeSpec&) const throw() bool \fBoperator >\fP(const WyTimeSpec&) const throw() bool \fBoperator >=\fP(const WyTimeSpec&) const throw() bool \fBoperator <\fP(const WyTimeSpec&) const throw() bool \fBoperator <=\fP(const WyTimeSpec&) const throw() const WyTimeSpec \fBabs\fP(void) const throw(Reply) WyRet \fBadd\fP(Wy_Second,Wy_Nano) throw() WyRet \fBadd\fP(const WyTimeSpec&) throw() WyRet \fBsub\fP(Wy_Second,Wy_Nano) throw() WyRet \fBsub\fP(const WyTimeSpec&) throw() WyRet \fBmul\fP(long n) throw() WyRet \fBdiv\fP(long n) throw() static const WyTimeSpec \fBmin\fP(void) throw() static const WyTimeSpec \fBmax\fP(void) throw().SH "DESCRIPTION".\"--------------------------------------------.PP.BI "class Reply : public WyRet.PP Class specific throw type.\"--------------------------------------------.PP.BI "WyTimeSpec() throw()".PP Construct default object. second()= 0 nano()= 0.\"--------------------------------------------.PP.BI "WyTimeSpec(const WyTimeSpec& " "tm" ") throw()".PP Construct object by copy from \fItm\fP. second()= \fItm\fP.second() nano()= \fItm\fP.nano().\"--------------------------------------------.PP.BI "WyTimeSpec(Wy_Second " "sec," "Wy_Nano " "nano" ") throw(Reply)".PP Construct object of \fIsec\fP seconds and \fInano\fP nano seconds. second()= nomalized second from \fIsec\fP+(\fInano\fP/Giga) nano()= nomalized nano second from \fIsec\fP+(\fInano\fP/Giga) (Giga= 1000000000) sec/nsec is normalized iff 1. (sec>0) &&(nsec>=0)&&(nsec<Giga) 2. (sec<0) &&(nsec<=0)&&(nsec>-Giga) 3. (sec==0)&&(nsec>-Giga)&&(nsec<Giga).PP [\fBThrow\fP] Reply Wym_ERANGE Argument overrange.\"--------------------------------------------.PP.BI "WyTimeSpec(WyTimeSpec& " "src" ", Wy::ByMove_t) throw()".PP See Wy_Array(Wy_Array&, Wy::ByMove_t) in wy_array(3wy) for definition of the move constructor..\"--------------------------------------------.PP.BI "WyTimeSpec(const WyCSeg& " "cseg" ") throw(Reply)".PP Construct object from the character string pointed by \fIcseg\fP. The accepted string is in the form: [+-]ddd or [+-]ddd.ddd[(eE)[+-]ddd], and radix is 10. second()= converted from the string notation pointed by \fIcseg\fP nano()= ditto Note: Digits representing numbers less than 1/billion are truncated.PP [\fBThrow\fP] Reply Wym_EBADMSG No digit or invalid digit Wym_ERANGE Argument overrange Note: Construction of \fIcseg\fP might throw WyCSeg::Reply(Wym_EFAULT).\"--------------------------------------------.PP.BI "bool is_default(void) const throw()".PP Is *this equivalent to the default object.PP [\fBRet\fP] true= *this is equivalent to WyTimeSpec() false= otherwise.\"--------------------------------------------.PP.BI "Wy_Second second(void) const throw()".PP Get the second part of *this.PP [\fBRet\fP] The whole number(second) part of *this.\"--------------------------------------------.PP.BI "Wy_Nano nano(void) const throw()".PP Get the nano-second part of *this.PP [\fBRet\fP] The nano-second part of *this The returned value is negative if *this<WyTimeSpec(0,0).\"--------------------------------------------.PP.BI "void reset(void) throw()" .PP Reconstruct *this to the state as WyTimeSpec().PP.\"--------------------------------------------.BI "void reset(const WyTimeSpec& " "tm" ") throw()" .PP Reconstruct *this to the state as WyTimeSpec(\fItm\fP).\"--------------------------------------------.PP.BI "WyRet reset(Wy_Second " "sec" ", Wy_Nano " "nano" ") throw()".PP Reconstruct *this to the state as WyTimeSpec(\fIsec\fP,\fInano\fP).PP [\fBRet\fP] Ok Succeed Wym_ERANGE Argument overrange.\"--------------------------------------------.PP.BI "WyRet reset(const WyCSeg& " "cseg" ") throw()".PP Reconstruct *this to the state as WyTimeSpec(\fIcseg\fP).PP [\fBRet\fP] Ok Succeed Wym_EBADMSG No digit or invalid digit Wym_ERANGE Argument overrange Note: Construction of \fIcseg\fP might throw WyCSeg::Reply(Wym_EFAULT).\"--------------------------------------------.PP.BI "void swap(WyTimeSpec& " "tm" ") throw()".PP Interchange state of *this with \fItm\fP.\"--------------------------------------------.PP.BI "WyTimeSpec& operator =(const WyTimeSpec& " "tm" ") throw()".PP Assign *this to the state as WyTimeSpec(\fItm\fP).PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "WyTimeSpec& operator =(const WyCSeg& " "cseg" ") throw(Reply)".PP Assign *this to the state as WyTimeSpec(\fIcseg\fP).PP [\fBThrow\fP] Reply Wym_EBADMSG No digit or invalid digit Wym_ERANGE Argument overrange.PP [\fBRet\fP] Reference of *this Note: Construction of \fIcseg\fP might throw WyCSeg::Reply(Wym_EFAULT).\"--------------------------------------------.PP.BI "const WyTimeSpec operator -() const throw(Reply)".PP Get the negative of *this.PP [\fBThrow\fP] Reply Wym_EMATHNEG Negation failure.PP [\fBRet\fP] WyTimeSpec object, the negative of *this.\"--------------------------------------------.PP.BI "WyTimeSpec& operator ++() throw(Reply)".PP Increase second by one.PP [\fBThrow\fP] Reply Wym_ERANGE Result overflow.PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "WyTimeSpec& operator --() throw(Reply)".PP Decrease second by one.PP [\fBThrow\fP] Reply Wym_ERANGE Result overflow.PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "const WyTimeSpec operator ++(int) throw(Reply)".PP Increase second by one.PP [\fBThrow\fP] Reply Wym_ERANGE Result overflow.PP [\fBRet\fP] Reference of *this (before operation).\"--------------------------------------------.PP.BI "const WyTimeSpec operator --(int) throw(Reply)".PP Decrease second by one.PP [\fBThrow\fP] Reply Wym_ERANGE Result overflow.PP [\fBRet\fP] Reference of *this (before operation).\"--------------------------------------------.PP.BI "WyTimeSpec& operator +=(const WyTimeSpec& " "tm" ") throw(Reply)".PP Accumulate *this by \fItm\fP.PP [\fBThrow\fP] Reply Wym_ERANGE Value conversion failed.PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "WyTimeSpec& operator -=(const WyTimeSpec& " "tm" ") throw(Reply)".PP Subtract *this by \fItm\fP.PP [\fBThrow\fP] Reply Wym_ERANGE Value conversion failed.PP [\fBRet\fP] Reference of *this.\"--------------------------------------------.PP.BI "const WyTimeSpec operator +(const WyTimeSpec& " "tm" ") const throw(Reply)".PP Get the addition of *this and \fItm\fP.PP [\fBThrow\fP] Reply Wym_ERANGE Value conversion failed.PP [\fBRet\fP] WyTimeSpec object the sum of *this and \fItm\fP.\"--------------------------------------------.PP.BI "const WyTimeSpec operator -(const WyTimeSpec& " "tm" ") const throw(Reply)".PP Get the subtraction of *this and \fItm\fP.PP [\fBThrow\fP] Reply Wym_ERANGE Value conversion failed.PP [\fBRet\fP] WyTimeSpec the substaction of *this and \fItm\fP.\"--------------------------------------------.PP.BI "bool operator ==(const WyTimeSpec& " "tm" ") const throw()".PP.BI "bool operator !=(const WyTimeSpec& " "tm" ") const throw()".PP.BI "bool operator >(const WyTimeSpec& " "tm" ") const throw()".PP.BI "bool operator >=(const WyTimeSpec& " "tm" ") const throw()".PP.BI "bool operator <(const WyTimeSpec& " "tm" ") const throw()".PP.BI "bool operator <=(const WyTimeSpec& " "tm" ") const throw()".PP Comparisons of *this and \fItm\fP.PP [\fBRet\fP] true= relation holds false= otherwise.\"--------------------------------------------.PP.BI "const WyTimeSpec abs(void) const throw(Reply)".PP Get the absolute value of *this.PP [\fBThrow\fP] Reply Wym_EMATHNEG Negation failure.PP [\fBRet\fP] WyTimeSpec, the absolute value of *this.\"--------------------------------------------.PP.BI "WyRet add(Wy_Second " "sec," " Wy_Nano " "nano" ") throw()".PP Add \fIsec\fP seconds and \fInano\fP nano seconds to *this. .PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range.\"--------------------------------------------.PP.BI "WyRet add(const WyTimeSpec& " "tm" ") throw()".PP Add \fItm\fP to *this .PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range.\"--------------------------------------------.PP.BI "WyRet sub(Wy_Second " "sec," " Wy_Nano " "nano" ") throw()".PP Subtract \fIsec\fP seconds and \fInano\fP nano seconds from *this .PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range.\"--------------------------------------------.PP.BI "WyRet sub(const WyTimeSpec& " "tm" ") throw()".PP Subtract \fItm\fP from *this .PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range.\"--------------------------------------------.PP.BI "WyRet mul(long " "v" ") throw()".PP Multiply *this by \fIv\fP.PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range.\"--------------------------------------------.PP.BI "WyRet div(long " "v" ") throw()".PP Divide *this by \fIv\fP.PP [\fBRet\fP] Ok Succeed Wym_ERANGE Result out of range Wym_EDIVZERO Divisor is zero.\"--------------------------------------------.PP.BI "static const WyTimeSpec min(void) throw()".PP Get the minimal value of WyTimeSpec.PP [\fBRet\fP] The minimal value of WyTimeSpec.\"--------------------------------------------.PP.BI "static const WyTimeSpec max(void) throw()".PP Get the maximal value of WyTimeSpec.PP [\fBRet\fP] The maximal value of WyTimeSpec.\"--------------------------------------------.SH "SEE ALSO".BR wyret.BR wy.BR wycseg.BR wymutex.BR wycond.BR wyonce.BR wydate.BR wy_thread.SH NOTEProject is in development, http://sourceforge.net/projects/libwx
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -