]>
Dogcows Code - chaz/yoink/blob - src/stlplus/subsystems/timer.cpp
1 ////////////////////////////////////////////////////////////////////////////////
3 // Author: Andy Rushton
4 // Copyright: (c) Southampton University 1999-2004
5 // (c) Andy Rushton 2004-2009
6 // License: BSD License, see ../docs/license.html
8 ////////////////////////////////////////////////////////////////////////////////
10 #include "dprintf.hpp"
13 ////////////////////////////////////////////////////////////////////////////////
18 ////////////////////////////////////////////////////////////////////////////////
29 void timer::reset(void)
35 float timer::cpu(void) const
37 return ((float)(clock() - m_clock
)) / ((float)CLOCKS_PER_SEC
);
40 float timer::elapsed(void) const
42 return ((float)(time(0) - m_time
));
45 std::string
timer::text(void) const
47 return dformat("%4.2fs CPU, %s elapsed", cpu(), delaytime_string(time(0)-m_time
).c_str());
50 ////////////////////////////////////////////////////////////////////////////////
52 std::ostream
& operator << (std::ostream
& str
, const timer
& t
)
54 return str
<< t
.text();
57 ////////////////////////////////////////////////////////////////////////////////
59 } // end namespace stlplus
This page took 0.034069 seconds and 4 git commands to generate.