]> git.donarmstrong.com Git - lilypond.git/blob - flower/cpu-timer.cc
release: 0.1.43
[lilypond.git] / flower / cpu-timer.cc
1 /*
2   cpu-timer.cc -- implement Cpu_timer
3
4   source file of the Flower Library
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "cpu-timer.hh"
10
11 // nextstep
12 #ifndef CLOCKS_PER_SEC
13 #define CLOCKS_PER_SEC  CLK_TCK
14 #endif
15
16
17 Cpu_timer::Cpu_timer ()
18 {
19   restart ();
20 }
21 void
22 Cpu_timer::restart ()
23 {
24   start_clock_ = clock ();
25 }
26
27 Real
28 Cpu_timer::read ()
29 {
30   clock_t stop = clock ();
31   return (stop-start_clock_)/Real(CLOCKS_PER_SEC);
32 }