minor refinement
This commit is contained in:
parent
91b6a72bd1
commit
4554a90752
4 changed files with 14 additions and 13 deletions
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/include/LiveSupport/Core/TimeConversion.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -71,7 +71,7 @@ using namespace LiveSupport;
|
||||||
* A helper object holding static time conversion functions.
|
* A helper object holding static time conversion functions.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.7 $
|
* @version $Revision: 1.8 $
|
||||||
*/
|
*/
|
||||||
class TimeConversion
|
class TimeConversion
|
||||||
{
|
{
|
||||||
|
@ -145,7 +145,7 @@ class TimeConversion
|
||||||
* @param duration sleep for this duration.
|
* @param duration sleep for this duration.
|
||||||
*/
|
*/
|
||||||
static Ptr<std::string>::Ref
|
static Ptr<std::string>::Ref
|
||||||
timeDurationToStringMilliseconds(Ptr<time_duration>::Ref duration)
|
timeDurationToSmilString(Ptr<time_duration>::Ref duration)
|
||||||
throw ();
|
throw ();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.7 $
|
Version : $Revision: 1.8 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversion.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversion.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -157,7 +157,7 @@ TimeConversion :: sleep(Ptr<time_duration>::Ref duration)
|
||||||
* Convert a time_duration to a format used in SMILs.
|
* Convert a time_duration to a format used in SMILs.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
Ptr<std::string>::Ref
|
Ptr<std::string>::Ref
|
||||||
TimeConversion :: timeDurationToStringMilliseconds(
|
TimeConversion :: timeDurationToSmilString(
|
||||||
Ptr<time_duration>::Ref duration)
|
Ptr<time_duration>::Ref duration)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,7 @@ TimeConversion :: timeDurationToStringMilliseconds(
|
||||||
int microseconds = duration->fractional_seconds();
|
int microseconds = duration->fractional_seconds();
|
||||||
stringStream << "."
|
stringStream << "."
|
||||||
<< std::setw(3) << std::setfill('0') << std::dec
|
<< std::setw(3) << std::setfill('0') << std::dec
|
||||||
<< microseconds / 1000
|
<< (microseconds + 500) / 1000
|
||||||
<< 's';
|
<< 's';
|
||||||
Ptr<std::string>::Ref result(new std::string(stringStream.str()));
|
Ptr<std::string>::Ref result(new std::string(stringStream.str()));
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.6 $
|
Version : $Revision: 1.7 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversionTest.cxx,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversionTest.cxx,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -215,16 +215,17 @@ TimeConversionTest :: sleepTest(void)
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Test the timeDurationToStringMilliseconds() function
|
* Test the timeDurationToSmilString() function
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
TimeConversionTest :: durationToStringTest(void)
|
TimeConversionTest :: durationToStringTest(void)
|
||||||
throw (CPPUNIT_NS::Exception)
|
throw (CPPUNIT_NS::Exception)
|
||||||
{
|
{
|
||||||
Ptr<time_duration>::Ref duration(new time_duration(1,2,3,4000));
|
Ptr<time_duration>::Ref duration(new time_duration(duration_from_string(
|
||||||
|
"01:02:03.003700" )));
|
||||||
|
|
||||||
Ptr<std::string>::Ref durationString
|
Ptr<std::string>::Ref durationString
|
||||||
= TimeConversion::timeDurationToStringMilliseconds(
|
= TimeConversion::timeDurationToSmilString(
|
||||||
duration);
|
duration);
|
||||||
CPPUNIT_ASSERT_EQUAL(std::string("3723.004s"), *durationString);
|
CPPUNIT_ASSERT_EQUAL(std::string("3723.004s"), *durationString);
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
|
|
||||||
Author : $Author: fgerlits $
|
Author : $Author: fgerlits $
|
||||||
Version : $Revision: 1.5 $
|
Version : $Revision: 1.6 $
|
||||||
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversionTest.h,v $
|
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/TimeConversionTest.h,v $
|
||||||
|
|
||||||
------------------------------------------------------------------------------*/
|
------------------------------------------------------------------------------*/
|
||||||
|
@ -58,7 +58,7 @@ namespace Core {
|
||||||
* Unit test for the TimeConversion class.
|
* Unit test for the TimeConversion class.
|
||||||
*
|
*
|
||||||
* @author $Author: fgerlits $
|
* @author $Author: fgerlits $
|
||||||
* @version $Revision: 1.5 $
|
* @version $Revision: 1.6 $
|
||||||
* @see TimeConversion
|
* @see TimeConversion
|
||||||
*/
|
*/
|
||||||
class TimeConversionTest : public CPPUNIT_NS::TestFixture
|
class TimeConversionTest : public CPPUNIT_NS::TestFixture
|
||||||
|
@ -115,7 +115,7 @@ class TimeConversionTest : public CPPUNIT_NS::TestFixture
|
||||||
sleepTest(void) throw (CPPUNIT_NS::Exception);
|
sleepTest(void) throw (CPPUNIT_NS::Exception);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the timeDurationToStringMilliseconds() function.
|
* Test the timeDurationToSmilString() function.
|
||||||
*
|
*
|
||||||
* @exception CPPUNIT_NS::Exception on test failures.
|
* @exception CPPUNIT_NS::Exception on test failures.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue