DonationCoder.com Software > Finished Programs
DONE: Run At Specified Time
sprint907:
I have written a C program which will do only what I had described as a requirement, ie.. wait till next day...
The source code is below...
/********************************************************************************/
/*
This program compiles fine on Microsoft Visual C++ 6.0.
Generated exe is 96kb in size. How to reduce the size?
*/
#include "stdafx.h"
#include "stdlib.h"
#include "time.h"
int main(int argc, char* argv[])
{
if(argc > 1) {
printf("This program sleeps till the end of current day. ie.. exits when a new day starts.\n");
return 0;
}
bool nextDay = false;
char* inputDate = "";
char* inputTime = "";
struct tm *newtime;
time_t long_time;
time( &long_time ); /* Get time as long integer. */
newtime = localtime( &long_time ); /* Convert to local time. */
int currentDate = newtime->tm_mday;
for( ;; ) { /* loop as along as required */
_sleep(1000);
time( &long_time ); /* Get time as long integer. */
newtime = localtime( &long_time ); /* Convert to local time. */
//printf( "%.19s %s\n", asctime( newtime ), am_pm );
int newDate = newtime->tm_mday;
if(currentDate != newDate ) { /* exit out of loop when date changes . ie.. next day */
break;
}
}
return 0;
}
/********************************************************************************/
Hope this helps someone.
Will attach binary tomorrow.
Ath:
I have written a C program which will do only what I had described as a requirement, ie.. wait till next day...
-sprint907 (November 21, 2012, 01:53 AM)
--- End quote ---
That is what my 1.0.0 version, released a week ago (parameter: -+1), can do already... :-\
sprint907:
Yes Ath, and thank you for that.
I was trying to replicate the functions of your utility... but it was too much work :(
so, I settled with a "one function only" utility :)
sprint907:
Attaching the binary and source code in a zip file.
Thanks Ath and rjbull for their help.
Navigation
[0] Message Index
[*] Previous page
Go to full version