summaryrefslogtreecommitdiffstats
path: root/b.c
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2024-12-16 14:02:21 +0200
committergrm <grm@eyesin.space>2024-12-16 14:02:21 +0200
commitbbcc41762f335e90dc850dd9d4a6cc5e51631c7c (patch)
treeb3d983283fcc1340268a1d812f0e57e2552afefb /b.c
parentf58834cfa1186373781761cd74e044fc9359c051 (diff)
downloadcgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.tar.gz
cgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.tar.bz2
cgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.zip
upkeep
Diffstat (limited to 'b.c')
-rw-r--r--b.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/b.c b/b.c
index 22a2304..89ea2ce 100644
--- a/b.c
+++ b/b.c
@@ -210,9 +210,29 @@ build_objects(const char* lang,
return true;
}
+#include <time.h>
+float
+current_time()
+{
+ static struct timespec startTime;
+ static int isStartTimeInitialized = 0;
+
+ if (!isStartTimeInitialized) {
+ clock_gettime(CLOCK_MONOTONIC, &startTime);
+ isStartTimeInitialized = 1;
+ }
+
+ struct timespec currentTime;
+ clock_gettime(CLOCK_MONOTONIC, &currentTime);
+
+ return (currentTime.tv_sec - startTime.tv_sec) +
+ (currentTime.tv_nsec - startTime.tv_nsec) / 1e9f;
+}
+
int
main(int argc, char *argv[])
{
+ float before_build = current_time();
B_GO_REBUILD_URSELF(argc, argv);
const char *program_name = b_shift_args(&argc, &argv);
@@ -275,6 +295,8 @@ main(int argc, char *argv[])
if (!build_objects("C++", "src/cplusplus.cpp", cplusplus_deps, B_ARRAY_LEN(cplusplus_deps), objects, &it)) return 1;
if (!build_c(force, &cmd, render_paths, B_ARRAY_LEN(render_paths), render_deps, B_ARRAY_LEN(render_deps), objects, B_ARRAY_LEN(objects), BUILD_DIR"render")) return 1;
+ b_log(B_INFO, "Build time: %.3f seconds", current_time() - before_build);
+
return 0;
}
/*