annotate quicktimer.c @ 3:bdd83d6807d5 default tip

Autmatic Win32 Porting
author VilyaemKenyaz
date Thu, 28 Sep 2023 13:22:04 -0400
parents 0dbfb504309e
children
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>
3
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
5 //#include <string.h>
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
6 //#include <stdbool.h>
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
7 //#include <time.h>
0
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
8
ee518e7d265d First Commit
VilyaemKenyaz
parents:
diff changeset
9
3
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
10 void main(int argc, char* argv[]){
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
11 //unsigned int timeleft;
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
12 if (argc == 1){
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
13 puts("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n");
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
14 exit(1);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
15 }
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
16 /*
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
17 if(clock == -1){
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
18 puts("Quicktimer does not have access to the time, clock_t clock is -1!\n");
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
19 exit(2);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
20 }
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
21 */
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
22 unsigned int timeleft = atoi(argv[1]);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
23 printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
24
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
25 while (timeleft != 0){
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
26 timeleft -= 1;
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
27 printf("Time left: %d\n", timeleft);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
28 sleep(1);
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
29 }
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
30 printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");
bdd83d6807d5 Autmatic Win32 Porting
VilyaemKenyaz
parents: 2
diff changeset
31 exit(0);
1
5725e5313328 Almost functional, need to interpret arg correctly, also ugly system() usage
VilyaemKenyaz
parents: 0
diff changeset
32 }