File: Synopsis/Timer.hh
 1//
 2// Copyright (C) 2004 Stefan Seefeld
 3// All rights reserved.
 4// Licensed to the public under the terms of the GNU LGPL (>= 2),
 5// see the file COPYING for details.
 6//
 7
 8#ifndef Synopsis_Timer_hh_
 9#define Synopsis_Timer_hh_
10
11#include <ctime>
12
13namespace Synopsis
14{
15
16class Timer
17{
18public:
19  Timer() : my_start(std::clock()) {}
20  double elapsed() const { return  double(std::clock() - my_start) / CLOCKS_PER_SEC;}
21private:
22  std::clock_t my_start;
23};
24
25}
26
27#endif