view 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
line wrap: on
line source

// Quicktimer by William King, makes a quick timer

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <time.h>


int main(int argc, char* argv[]){
//unsigned int timeleft;
if (argc == 1){
printf("QuickTimer by Vilyaem peepsoftgames.github.io thekenyaz@yandex.com\n Usage:\n quicktimer (unsigned int seconds)\n");
return 1;
}
if(clock == -1){
printf("Quicktimer does not have access to the time, clock_t clock is -1!\n");
return 2;
}
unsigned int timeleft = 60; //argv[1];
printf("Starting Quicktimer Ctrl-C to stop. Time left %d \n", timeleft);

while (timeleft != 0){
timeleft -= 1; //clock()/CLOCKS_PER_SEC;
printf("Time left: %d\n", timeleft);
system("sleep 1"); // LORD!

}

printf("%d\n",&timeleft);
printf("Timer has finished, enjoy your day. Glory to the Father, the Son, and the Holy Spirit\n");

}