Code Cleanup
- Cmake was not updating HAVE_ST_BIRTHTIME.
- NIBBLER_FEATURE_DATE was not properly applied everywhere.
- FEATURE_COLOR was not properly set.
- Some source files failed to include cmake.h, and therefore were not properly
- Removed inefficient use of std::string::substr for guaranteed single character
strings.
- Integrated Directory::cd.
- Integrated File::ctime, ::btime.
- Integrated Path::operator+.
- Integrated Nibbler::getDigit{2,4,6}.
- Integrated HighResTimer.
enabling/disabling code.
- All Path objects now expanded internally to absolute form.
- Modified unit tests to accomodate absolute paths.
- Merged new nibbler.t.cpp tests.
- Made various methods const.
- Includes removed from some files, added to others.
This commit is contained in:
@@ -112,3 +112,40 @@ void Timer::subtract (unsigned long value)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
HighResTimer::HighResTimer ()
|
||||
{
|
||||
_start.tv_sec = 0;
|
||||
_start.tv_usec = 0;
|
||||
|
||||
_stop.tv_sec = 0;
|
||||
_stop.tv_usec = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
HighResTimer::~HighResTimer ()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void HighResTimer::start ()
|
||||
{
|
||||
gettimeofday (&_start, NULL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
void HighResTimer::stop ()
|
||||
{
|
||||
gettimeofday (&_stop, NULL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
double HighResTimer::total () const
|
||||
{
|
||||
if (_stop.tv_sec > 0 || _stop.tv_usec > 0)
|
||||
return (_stop.tv_sec - _start.tv_sec) +
|
||||
(_stop.tv_usec - _start.tv_usec) / 1000000.0;
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user