0

So i am making a piece of program In C but i cant get to check the system time and execute IF the time is equal to the systems time.

in Plain english this is what my program is supposed to do.

#
# LIBRARIES
#

1. Check the system Time.
2. Program here the set time i want ( will change this often )
3. If the time i Programmed Is equal to the system time
do this or stop my program from working.
4. (else if ) otherwise if the time isnt my specified Time
then continue until the time is exact once again to step 3.


Basically i want this little noob program to delete my daily Junk on my computer everyday with file extensions i will provide in a

remove(file.tiff);

:) thnx in advance.

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by BobS0327
0

So i am making a piece of program In C but i cant get to check the system time and execute IF the time is equal to the systems time.

in Plain english this is what my program is supposed to do.

#
# LIBRARIES
#

1. Check the system Time.
2. Program here the set time i want ( will change this often )
3. If the time i Programmed Is equal to the system time
do this or stop my program from working.
4. (else if ) otherwise if the time isnt my specified Time
then continue until the time is exact once again to step 3.


Basically i want this little noob program to delete my daily Junk on my computer everyday with file extensions i will provide in a

remove(file.tiff);

:) thnx in advance.

The code below will determine the number of days between two days. You'll have to add the hours, minutes and seconds difference calculation to the code which should be a trivial task. But anyway, it'll get you started.

#include <stdio.h>

unsigned long CalcDays(int iMonth, int iDay, int iYear)
{
    return (iDay + (153 * (iMonth + 12 * ((14 - iMonth) / 12) - 3) + 2) / 5 + 365 *
        (iYear + 4800 - ((14 - iMonth) / 12)) + (iYear + 4800 - ((14 - iMonth) / 12)) / 4 - 32083);
}

int main(void)
{
    printf("Days betweeen dates: %d\n", CalcDays(3, 10, 2012) - CalcDays(2, 16, 2006) );
    return 0;
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.