[Opalvoip-svn] SF.net SVN: opalvoip:[23814] ptlib/trunk/include/ptlib
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2009-11-30 03:07:48
|
Revision: 23814 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=23814&view=rev Author: rjongbloed Date: 2009-11-30 03:07:39 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Added division operator for two PTimeInterval instances to yield an integer. Modified Paths: -------------- ptlib/trunk/include/ptlib/osutil.inl ptlib/trunk/include/ptlib/timeint.h Modified: ptlib/trunk/include/ptlib/osutil.inl =================================================================== --- ptlib/trunk/include/ptlib/osutil.inl 2009-11-30 02:18:30 UTC (rev 23813) +++ ptlib/trunk/include/ptlib/osutil.inl 2009-11-30 03:07:39 UTC (rev 23814) @@ -75,6 +75,9 @@ PINLINE PTimeInterval & PTimeInterval::operator*=(int f) { SetMilliSeconds(GetMilliSeconds() * f); return *this; } +PINLINE int PTimeInterval::operator/(const PTimeInterval & t) const + { return (int)(GetMilliSeconds() / t.GetMilliSeconds()); } + PINLINE PTimeInterval PTimeInterval::operator/(int f) const { return PTimeInterval(GetMilliSeconds() / f); } Modified: ptlib/trunk/include/ptlib/timeint.h =================================================================== --- ptlib/trunk/include/ptlib/timeint.h 2009-11-30 02:18:30 UTC (rev 23813) +++ ptlib/trunk/include/ptlib/timeint.h 2009-11-30 03:07:39 UTC (rev 23814) @@ -267,6 +267,15 @@ int factor ///< factor to multiply. ); + /** Divide the time interval by another interval yielding a count. + + @return + the number of times the second interval occurs in the larger. + */ + int operator/( + const PTimeInterval & smaller ///< factor to divide. + ) const; + /** Divide the time interval by a factor yielding a third time interval. @return This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |