comparison quicktimer.c @ 2:0dbfb504309e

Finished program
author VilyaemKenyaz
date Wed, 26 Jul 2023 03:46:13 -0400
parents 5725e5313328
children bdd83d6807d5
comparison
equal deleted inserted replaced
1:5725e5313328 2:0dbfb504309e
15 } 15 }
16 if(clock == -1){ 16 if(clock == -1){
17 printf("Quicktimer does not have access to the time, clock_t clock is -1!\n"); 17 printf("Quicktimer does not have access to the time, clock_t clock is -1!\n");
18 return 2; 18 return 2;
19 } 19 }
20 unsigned int timeleft = 60; //argv[1]; 20 unsigned int timeleft = atoi(argv[1]);
21 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft); 21 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft);
22 22
23 while (timeleft != 0){ 23 while (timeleft != 0){
24 timeleft -= 1; //clock()/CLOCKS_PER_SEC; 24 timeleft -= 1; //clock()/CLOCKS_PER_SEC;
25 printf("Time left: %d\n", timeleft); 25 printf("Time left: %d\n", timeleft);
26 system("sleep 1"); // LORD! 26 //system("sleep 1"); // LORD!
27 sleep(1);
27 28
28 } 29 }
29 30
30 printf("%d\n",&timeleft);
31 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n"); 31 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");
32 32
33 } 33 }