I want to convert a given time into epoch(time_t) and vice versa. can anyone tell what is the routine or algorithm for this?
Thanks
Update
epoch_strt.tm_sec = 0;
epoch_strt.tm_min = 0;
epoch_strt.tm_hour = 0;
epoch_strt.tm_mday = 1;
epoch_strt.tm_mon = 1;
epoch_strt.tm_year = 70;
epoch_strt.tm_isdst = -1;
double nsecs = difftime(curtime, basetime);//current time from system, I converrting it to struct tm
but this always return 32399 for some reason.
See Question&Answers more detail:os