We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 20c86e7 commit 9cc9aa7Copy full SHA for 9cc9aa7
timer.c
@@ -0,0 +1,23 @@
1
+#include <time.h>
2
+#include "display.h"
3
+
4
+static clock_t start = 0, end = 0;
5
+static const char* runningJob[] = {"Nothing"};
6
7
+void timer_end(){
8
+ if(start != 0){
9
+ end = clock();
10
+ double sec = (double)(end-start)/CLOCKS_PER_SEC;
11
+ info("%s finished in %f seconds\n", runningJob[0], sec);
12
+ start = end = 0;
13
+ runningJob[0] = "Nothing";
14
+ }
15
+}
16
17
+void timer_start(const char* job){
18
+ if(start != 0)
19
+ timer_end();
20
+ runningJob[0] = job;
21
+ info("Started %s\n", job);
22
+ start = clock();
23
timer.h
@@ -0,0 +1,4 @@
+#pragma once
+void timer_start(const char* job);
+void timer_end();
0 commit comments