time conversion routines now properly throw exceptions, when needed

This commit is contained in:
maroy 2004-12-13 13:56:13 +00:00
parent b937849015
commit b9495ba094
2 changed files with 13 additions and 7 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
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: maroy $ * @author $Author: maroy $
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
class TimeConversion class TimeConversion
{ {
@ -91,9 +91,12 @@ class TimeConversion
* *
* @param timeval the struct timeval to convert. * @param timeval the struct timeval to convert.
* @return a boost::posix_time::ptime, holding the same time. * @return a boost::posix_time::ptime, holding the same time.
* @exception std::out_of_range if timeval represents a time that
* can not be handled by ptime
*/ */
static Ptr<ptime>::Ref static Ptr<ptime>::Ref
timevalToPtime(const struct timeval *timeval) throw (); timevalToPtime(const struct timeval *timeval)
throw (std::out_of_range);
/** /**
* Convert a struct tm to a boost::posix_time::ptime, * Convert a struct tm to a boost::posix_time::ptime,
@ -101,9 +104,12 @@ class TimeConversion
* *
* @param time the struct tm to convert. * @param time the struct tm to convert.
* @return a boost::posix_time::ptime, holding the same time. * @return a boost::posix_time::ptime, holding the same time.
* @exception std::out_of_range if time represents a time that
* can not be handled by ptime
*/ */
static Ptr<ptime>::Ref static Ptr<ptime>::Ref
tmToPtime(const struct tm *time) throw (); tmToPtime(const struct tm *time)
throw (std::out_of_range);
/** /**
* Return the current time, with microsecond precision. * Return the current time, with microsecond precision.

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -57,7 +57,7 @@ using namespace LiveSupport::Core;
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<ptime>::Ref Ptr<ptime>::Ref
TimeConversion :: timevalToPtime(const struct timeval *timeval) TimeConversion :: timevalToPtime(const struct timeval *timeval)
throw () throw (std::out_of_range)
{ {
// don't convert through the boost::posix_time::from_time_t() function // don't convert through the boost::posix_time::from_time_t() function
// as probably because of timezone settings it ruins the actual value // as probably because of timezone settings it ruins the actual value
@ -80,7 +80,7 @@ TimeConversion :: timevalToPtime(const struct timeval *timeval)
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<ptime>::Ref Ptr<ptime>::Ref
TimeConversion :: tmToPtime(const struct tm *time) TimeConversion :: tmToPtime(const struct tm *time)
throw () throw (std::out_of_range)
{ {
// don't convert through the boost::posix_time::from_time_t() function // don't convert through the boost::posix_time::from_time_t() function
// as probably because of timezone settings it ruins the actual value // as probably because of timezone settings it ruins the actual value