stopwatch.cpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Includes
00011 *****************************************************************************/
00012 
00013 #include "../../include/ecl/time/timestamp.hpp"
00014 #include "../../include/ecl/time/stopwatch.hpp"
00015 #ifdef ECL_HAS_TIMESTAMP
00016 
00017 /*****************************************************************************
00018 ** Namespaces
00019 *****************************************************************************/
00020 
00021 namespace ecl {
00022 
00023 /*****************************************************************************
00024 ** Implementation [StopWatch]
00025 *****************************************************************************/
00026 StopWatch::StopWatch() {
00027     // The variable start_time will automatically initialise with the current
00028     // system time.
00029 };
00030 
00031 /*****************************************************************************
00032 ** Implementation
00033 *****************************************************************************/
00034 
00035 void StopWatch::restart()
00036 {
00037     start_time.stamp();
00038     split_time = start_time;
00039 }
00040 
00041 TimeStamp StopWatch::elapsed()
00042 {
00043     TimeStamp current_time; // Automatically fetches the current system time.
00044     return ( current_time - start_time );
00045 }
00046 
00047 TimeStamp StopWatch::split()
00048 {
00049     TimeStamp last_time = split_time;
00050     split_time.stamp();
00051     return (split_time - last_time);
00052 }
00053 
00054 }; // namespace ecl
00055 
00056 #endif /* ECL_HAS_TIMESTAMP */
00057 


ecl_time
Author(s): Daniel Stonier
autogenerated on Sun Oct 5 2014 23:35:32