Mercurial Hosting > quicktimer
annotate quicktimer.c @ 1:5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
author | VilyaemKenyaz |
---|---|
date | Wed, 26 Jul 2023 03:18:00 -0400 |
parents | ee518e7d265d |
children | 0dbfb504309e |
rev | line source |
---|---|
1
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
1 // Quicktimer by William King, makes a quick timer |
0 | 2 |
3 #include <stdio.h> | |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <stdbool.h> | |
7 #include <time.h> | |
8 | |
9 | |
10 int main(int argc, char* argv[]){ | |
11 //unsigned int timeleft; | |
1
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
12 if (argc == 1){ |
0 | 13 printf("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n"); |
14 return 1; | |
15 } | |
1
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
16 if(clock == -1){ |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
17 printf("Quicktimer does not have access to the time, clock_t clock is -1!\n"); |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
18 return 2; |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
19 } |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
20 unsigned int timeleft = 60; //argv[1]; |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
21 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft); |
0 | 22 |
1
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
23 while (timeleft != 0){ |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
24 timeleft -= 1; //clock()/CLOCKS_PER_SEC; |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
25 printf("Time left: %d\n", timeleft); |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
26 system("sleep 1"); // LORD! |
0 | 27 |
1
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
28 } |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
29 |
5725e5313328
Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents:
0
diff
changeset
|
30 printf("%d\n",&timeleft); |
0 | 31 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n"); |
32 | |
33 } |