if (row = mysql_fetch_row(res))
{
assert(atoi(row[0]) == contest_id);
time_t start_time = atoi(row[1]);
time_t stop_time = atoi(row[4]);
int duration = atoi(row[3]);
struct tm cur_time_tm;
struct tm start_time_tm;
struct tm stop_time_tm;
strncpy(sstart_time, row[1], sizeof(sstart_time));
strncpy(sstop_time, row[4], sizeof(sstop_time));
strptime(sstop_time, "%Y-%m-%d %H:%M:%S", &stop_time_tm);
strptime(sstart_time, "%Y-%m-%d %H:%M:%S", &start_time_tm);
printf("ascstarttime=%s;ascstop%s;\n", asctime(&start_time_tm), asctime(&stop_time_tm));
printf("startstr=%s;stopstr=%s\n", sstart_time, sstop_time);
start_time = mktime(&start_time_tm);
stop_time = mktime(&stop_time_tm);
printf("mkstart=%s;mkstop=%s\n", ctime(&start_time), ctime(&stop_time));
}
Output:
ascstarttime=Sat Jan 1 04:00:01 2000
;ascstopSat Jan 1 04:00:01 2000
;
startstr=2000-01-01 04:00:01;stopstr=2000-01-01 09:00:01
mkstart=Sat Jan 1 04:00:01 2000
;mkstop=Sat Jan 1 04:00:01 2000
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE