comparison quicktimer.c @ 3:bdd83d6807d5 default tip

Autmatic Win32 Porting
author VilyaemKenyaz
date Thu, 28 Sep 2023 13:22:04 -0400
parents 0dbfb504309e
children
comparison
equal deleted inserted replaced
2:0dbfb504309e 3:bdd83d6807d5
1 // Quicktimer by William King, makes a quick timer 1 // Quicktimer by William King, makes a quick timer
2 2
3 #include <stdio.h> 3 #include <stdio.h>
4 #include <stdlib.h> 4 #include <stdlib.h>
5 #include <string.h> 5 //#include <string.h>
6 #include <stdbool.h> 6 //#include <stdbool.h>
7 #include <time.h> 7 //#include <time.h>
8 8
9 9
10 int main(int argc, char* argv[]){ 10 void main(int argc, char* argv[]){
11 //unsigned int timeleft; 11 //unsigned int timeleft;
12 if (argc == 1){ 12 if (argc == 1){
13 printf("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n"); 13 puts("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n");
14 return 1; 14 exit(1);
15 }
16 /*
17 if(clock == -1){
18 puts("Quicktimer does not have access to the time, clock_t clock is -1!\n");
19 exit(2);
20 }
21 */
22 unsigned int timeleft = atoi(argv[1]);
23 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft);
24
25 while (timeleft != 0){
26 timeleft -= 1;
27 printf("Time left: %d\n", timeleft);
28 sleep(1);
29 }
30 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");
31 exit(0);
15 } 32 }
16 if(clock == -1){
17 printf("Quicktimer does not have access to the time, clock_t clock is -1!\n");
18 return 2;
19 }
20 unsigned int timeleft = atoi(argv[1]);
21 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft);
22
23 while (timeleft != 0){
24 timeleft -= 1; //clock()/CLOCKS_PER_SEC;
25 printf("Time left: %d\n", timeleft);
26 //system("sleep 1"); // LORD!
27 sleep(1);
28
29 }
30
31 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");
32
33 }