X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;ds=sidebyside;f=interpreters%2Fbocfel%2Fzoom.c;fp=interpreters%2Fbocfel%2Fzoom.c;h=e805762509ee732681d60f91b06f0e4274b6d443;hb=aa30979369091c96bca34499c28cb01bc16efb1d;hp=0000000000000000000000000000000000000000;hpb=61180dab8f5c29f5a29b83fcb7d62942f7a741d1;p=projects%2Fchimara%2Fchimara.git
diff --git a/interpreters/bocfel/zoom.c b/interpreters/bocfel/zoom.c
new file mode 100644
index 0000000..e805762
--- /dev/null
+++ b/interpreters/bocfel/zoom.c
@@ -0,0 +1,48 @@
+/*-
+ * Copyright 2010-2012 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 .
+ */
+
+#include
+#include
+
+#include "zoom.h"
+#include "screen.h"
+#include "zterp.h"
+
+static clock_t start_clock, end_clock;
+
+void zstart_timer(void)
+{
+ start_clock = clock();
+}
+
+void zstop_timer(void)
+{
+ end_clock = clock();
+}
+
+void zread_timer(void)
+{
+ store(100 * (end_clock - start_clock) / CLOCKS_PER_SEC);
+}
+
+void zprint_timer(void)
+{
+ char buf[32];
+ snprintf(buf, sizeof buf, "%.2f seconds", (end_clock - start_clock) / (double)CLOCKS_PER_SEC);
+ for(int i = 0; buf[i] != 0; i++) put_char(buf[i]);
+}