2 Copyright (C) 1998, 1999, 2000, 2007 John Anderson
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 namespace ArdourSurface {
34 millisecond timer class.
41 start the timer running if true, or just create the
44 Timer( bool shouldStart = true )
51 Start the timer running. Return the current timestamp, in milliseconds
55 _start = g_get_monotonic_time();
60 returns the number of milliseconds since start
61 also stops the timer running
65 _stop = g_get_monotonic_time();
70 returns the number of milliseconds since start
72 unsigned long elapsed() const
76 uint64_t now = g_get_monotonic_time();
77 return (now - _start) / 1000;
81 return (_stop - _start) / 1000;
86 Call stop and then start. Return the value from stop.
88 unsigned long restart()
90 unsigned long retval = stop();
101 } // Mackie namespace
102 } // ArdourSurface namespace