-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzoom.cpp
48 lines (41 loc) · 1.17 KB
/
zoom.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2010-2021 Chris Spiegel.
//
// This file is part of Bocfel.
//
// Bocfel is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License, version
// 2 or 3, as published by the Free Software Foundation.
//
// Bocfel is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Bocfel. If not, see <http://www.gnu.org/licenses/>.
#include <ctime>
#include <string>
#include "zoom.h"
#include "screen.h"
#include "util.h"
#include "zterp.h"
static std::clock_t start_clock, end_clock;
void zstart_timer()
{
start_clock = std::clock();
}
void zstop_timer()
{
end_clock = std::clock();
}
void zread_timer()
{
store(100 * (end_clock - start_clock) / CLOCKS_PER_SEC);
}
void zprint_timer()
{
std::string buf = fstring("%.2f seconds", (end_clock - start_clock) / static_cast<double>(CLOCKS_PER_SEC));
for (const auto &c : buf) {
put_char(c);
}
}