Go to the documentation of this file.00001
00002
00003
00004
00005 #include <cassert>
00006
00007 #include <stdair/basic/BasChronometer.hpp>
00008
00009 namespace stdair {
00010
00011
00012 BasChronometer::BasChronometer () : _startTimeLaunched (false) {
00013 }
00014
00015
00016 void BasChronometer::start () {
00017
00018 _startTime = boost::posix_time::microsec_clock::local_time();
00019
00020
00021
00022 _startTimeLaunched = true;
00023 }
00024
00025
00026 double BasChronometer::elapsed () const {
00027 assert (_startTimeLaunched == true);
00028
00029
00030 const boost::posix_time::ptime lStopTime =
00031 boost::posix_time::microsec_clock::local_time();
00032
00033
00034 const boost::posix_time::time_duration lElapsedTime =
00035 lStopTime - _startTime;
00036
00037
00038 const double lElapsedTimeInMicroSeconds =
00039 static_cast<const double> (lElapsedTime.total_microseconds());
00040
00041
00042 return (lElapsedTimeInMicroSeconds / 1e6);
00043 }
00044
00045 }