view quicktimer.c @ 2:0dbfb504309e

Finished program
author VilyaemKenyaz
date Wed, 26 Jul 2023 03:46:13 -0400
parents 5725e5313328
children bdd83d6807d5
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 = atoi(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!
sleep(1);

}

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

}