X-Git-Url: https://www.ginac.de/ginac.git//ginac.git?p=ginac.git;a=blobdiff_plain;f=check%2Ftimer.cpp;h=3400325e11641d9aa053b15c1be9b0cf6b19e058;hp=492339b634741cd00fde23b3d7485b5b34a9dd1c;hb=6d225ee55693c0617d254e6fa283c00c71bd2919;hpb=383d5eb3b0f0506810d9105a268f939125bfc347 diff --git a/check/timer.cpp b/check/timer.cpp index 492339b6..3400325e 100644 --- a/check/timer.cpp +++ b/check/timer.cpp @@ -3,7 +3,7 @@ * A simple stop watch class. */ /* - * GiNaC Copyright (C) 1999-2001 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2004 Johannes Gutenberg University Mainz, Germany * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,34 +20,38 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include "times.h" +#include +#include +#include -timer::timer(void) : on(false) +#include "timer.h" + +timer::timer() : on(false) { getrusage(RUSAGE_SELF, &used1); getrusage(RUSAGE_SELF, &used2); } -void timer::start(void) +void timer::start() { on = true; getrusage(RUSAGE_SELF, &used1); getrusage(RUSAGE_SELF, &used2); } -void timer::stop(void) +void timer::stop() { on = false; getrusage(RUSAGE_SELF, &used2); } -void timer::reset(void) +void timer::reset() { getrusage(RUSAGE_SELF, &used1); getrusage(RUSAGE_SELF, &used2); } -double timer::read(void) +double timer::read() { double elapsed; if (this->running()) @@ -60,7 +64,7 @@ double timer::read(void) return 0.01*int(elapsed*100+0.5); } -bool timer::running(void) +bool timer::running() { return on; }