annotate quicktimer.c @ 2:0dbfb504309e

Finished program
author VilyaemKenyaz
date Wed, 26 Jul 2023 03:46:13 -0400
parents 5725e5313328
children bdd83d6807d5
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 }
2
0dbfb504309e Finished program
VilyaemKenyaz
parents: 1
diff changeset
20 unsigned int timeleft = atoi(argv[1]);
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);
2
0dbfb504309e Finished program
VilyaemKenyaz
parents: 1
diff changeset
26 //system("sleep 1"); // LORD!
0dbfb504309e Finished program
VilyaemKenyaz
parents: 1
diff changeset
27 sleep(1);
0
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
28
1
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
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 }