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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
2
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
3 #include <stdio.h>
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
4 #include <stdlib.h>
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
5 #include <string.h>
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
6 #include <stdbool.h>
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
7 #include <time.h>
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
8
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
9
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
10 int main(int argc, char* argv[]){
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
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
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
13 printf("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n");
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
14 return 1;
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
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
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
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
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
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
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
31 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
32
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
33 }