2 * Copyright 2010-2012 Chris Spiegel.
4 * This file is part of Bocfel.
6 * Bocfel is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version
8 * 2 or 3, as published by the Free Software Foundation.
10 * Bocfel is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with Bocfel. If not, see <http://www.gnu.org/licenses/>.
26 static clock_t start_clock, end_clock;
28 void zstart_timer(void)
30 start_clock = clock();
33 void zstop_timer(void)
38 void zread_timer(void)
40 store(100 * (end_clock - start_clock) / CLOCKS_PER_SEC);
43 void zprint_timer(void)
46 snprintf(buf, sizeof buf, "%.2f seconds", (end_clock - start_clock) / (double)CLOCKS_PER_SEC);
47 for(int i = 0; buf[i] != 0; i++) put_char(buf[i]);