第1个回答 2017-01-20
思路, 24hour - (now - start of today)
/* difftime example */
#include <stdio.h> /* printf */
#include <time.h> /* time_t, struct tm, difftime, time, mktime */
int main ()
{
time_t now = time(NULL);
struct tm today = *localtime(&now);
double seconds;
today.tm_hour = 0; today.tm_min = 0; today.tm_sec = 0;
seconds = 24*60*60-difftime(now,mktime(&today));
printf (" %.f seconds left today\n" seconds);
return 0;
}本回答被网友采纳