Hello, I got some code from:
http://stackoverflow.com/questions/1859201/add-seconds-to-a-date
this is the code:
#include <time.h>
#include <stdio.h>
int main()
{
time_t now = time( NULL);
struct tm now_tm = *localtime( &now);
struct tm then_tm = now_tm;
then_tm.tm_sec += 50; // add 50 seconds to the time
mktime( &then_tm); // normalize it
printf( "%s\n", asctime( &now_tm));
printf( "%s\n", asctime( &then_tm));
return 0;
}
Unfortuantely I do not know much about the code, and need to write a program that records a time, and compares two times. I do not know much about the datatypes time_t, struct tm, and the functions localtime, mktime, asctime, etc. Any information on this would be helpful. I am hoping to write some firmware which will activate after a certain amount of time, once I know how to use c time I will be able to finish the firmware.