diff options
author | grm <grm@eyesin.space> | 2024-12-16 14:02:21 +0200 |
---|---|---|
committer | grm <grm@eyesin.space> | 2024-12-16 14:02:21 +0200 |
commit | bbcc41762f335e90dc850dd9d4a6cc5e51631c7c (patch) | |
tree | b3d983283fcc1340268a1d812f0e57e2552afefb /b.c | |
parent | f58834cfa1186373781761cd74e044fc9359c051 (diff) | |
download | cgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.tar.gz cgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.tar.bz2 cgame-bbcc41762f335e90dc850dd9d4a6cc5e51631c7c.zip |
upkeep
Diffstat (limited to 'b.c')
-rw-r--r-- | b.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -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, ¤tTime); + + 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; } /* |