advent2025

Advent of Code 2025 Solutions
git clone git://bsandro.tech/advent2025
Log | Files | Refs | README | LICENSE

cputime.h (287B)


      1 #pragma once
      2 #include <time.h>
      3 static volatile double time_started = 0;
      4 
      5 void __attribute((constructor)) begin() {
      6     time_started = clock();
      7 }
      8 
      9 void __attribute((destructor)) end() {
     10     double elapsed = clock() - time_started;
     11     printf("Elapsed: %f s\n", elapsed/CLOCKS_PER_SEC);
     12 }