easters

easters.dev solutions (C)
git clone git://bsandro.tech/easters
Log | Files | Refs | LICENSE

cputime.h (295B)


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