// get current time
time_t nowTS = time(0);
// convert to time structure
struct tm *sTime = localtime(&nowTS);
// set HH:MM:SS to zero
sTime->tm_hour = 0;
sTime->tm_min = 0;
sTime->tm_sec = 0;
// make new time_t from time structure
time_t midnight = mktime(sTime);
char sql[1024];
// format time_t as unixtime seconds using %llu format
sprintf(sql,"SELECT id FROM news WHERE timestamp > %llu", (unsigned long long)midnight);
time_t nowTS = time(0);
// convert to time structure
struct tm *sTime = localtime(&nowTS);
// set HH:MM:SS to zero
sTime->tm_hour = 0;
sTime->tm_min = 0;
sTime->tm_sec = 0;
// make new time_t from time structure
time_t midnight = mktime(sTime);
char sql[1024];
// format time_t as unixtime seconds using %llu format
sprintf(sql,"SELECT id FROM news WHERE timestamp > %llu", (unsigned long long)midnight);