all repos — shwarp-tools @ 4ee12ebfdb10e2543f2e6ff9fde3706b6929b60f

Tools and scripts

tool: init build-time script

Outputs estimated "real" build time by removing large gaps of time.
shwarp
Sun, 25 Oct 2026 22:43:33 -0400
commit

4ee12ebfdb10e2543f2e6ff9fde3706b6929b60f

parent

536615e0ed463c438ef3b72ccd6c7eb6484016f8

1 files changed, 45 insertions(+), 0 deletions(-)

jump to
A build-time

@@ -0,0 +1,45 @@

+#!/usr/bin/env bash + +if [[ $# -lt 1 ]] +then + echo "Usage: ./build-time <WAD_PATH>" + echo -e "\texample: ./build-time ~/doom/WIP/my-wad.wad" + + exit 1 +fi + +MAP_FILENAME=$(basename "$1") +GIT_DIR=$(echo ${1::-"$((${#MAP_FILENAME} + 1))"}) + +max_break_minutes=30 +max_break_seconds=$((max_break_minutes*60)) + +i=$((0)) +build_seconds=$((0)) +build_intervals=() +for timestamp in $(git -C "$GIT_DIR" log --reverse --format=format:%at) +do + # Prime the pump + if [[ $i -eq 0 ]] + then + build_intervals+=($timestamp) + else + prev_timestamp="${build_intervals[((i-1))]}" + seconds=$(echo "(${timestamp}-${prev_timestamp})" | bc) + + + build_intervals+=($timestamp) + + if [[ $seconds -lt $max_break_seconds ]] + then + ((build_seconds+=$seconds)) + else + + break_seconds=$(echo "(${timestamp}-${prev_timestamp})" | bc) + fi + fi + + ((i++)) +done + +echo "Build time: ${build_seconds}s"