c++ check time?
I am trying to make a program that checks if it is midnight, but I can't figure it out. I am using time.h. Can someone please post the code to check if it is midnight?
- Rah-Mon HeurLv 41 decade agoFavorite Answer
struct tm *newtime;
time( &long_time ); /* Get time as long integer. */
newtime = localtime( &long_time ); /* Convert to local time. */
bool bIsMidnight = (newtime->tm_hour) == 0 && (newtime->tm_min == 0) && (newtime->tm_sec == 0);