1 #include "../lib/include/timelib.h"
7 puts("prog seconds_of_cpu_time_to_burn");
11 long parse_human_number(char* num
) {
15 size_t l
= strlen(num
);
17 if(l
&& l
< sizeof(buf
)) {
19 ret
= 1024 * 1024 * 1024;
20 else if(num
[l
-1] == 'M')
22 else if(num
[l
-1] == 'K')
27 return atol(buf
) * ret
;
34 int main(int argc
, char** argv
) {
38 if (argc
!= 2) return syntax();
39 waste_secs
= parse_human_number(argv
[1]);
42 while(mspassed(&start
) < waste_secs
* 1000) {}
44 printf("successfully wasted %lu seconds of your cpu time\n", waste_secs
);