X-Git-Url: https://ginac.de/ginac.git//ginac.git?a=blobdiff_plain;f=check%2Ftimer.cpp;h=fff91e7dc44db0420ed2fcc0fb860bfa11f4b132;hb=f1773e57884cb269fcbd4033aa902002e418275b;hp=921e267aa3f189431cec389e855bd1976503d67e;hpb=e7cc6a764ff67b5885d6633385fac23ccc1dc9a7;p=ginac.git diff --git a/check/timer.cpp b/check/timer.cpp index 921e267a..fff91e7d 100644 --- a/check/timer.cpp +++ b/check/timer.cpp @@ -3,7 +3,7 @@ * A simple stop watch class. */ /* - * GiNaC Copyright (C) 1999-2002 Johannes Gutenberg University Mainz, Germany + * GiNaC Copyright (C) 1999-2005 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 @@ -17,37 +17,41 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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; }