Can some one tell me how do i display real time in c++. what i mean is that while the program is running you can see the seconds and or minutes counting down like a real clock h
Below is the a function within a program of mine that displays the current day of week, time (hh:mm) and date (dd/mm/yyy). When I used the SYSTEMTIME struct, I realized the time displayed was four hours too fast, so I resorted to this method. Hope this helps. Intended for Windows users...
void time()
{
cout << "The current date is: ";
system("date/t");
cout << "The current time is: ";
system("time/t");
cout << "Time zone: ";
system("tzutil /g");
cout << endl;
}
NOTE: This works by querying your system for the date, time, and timezone. Most seasoned programmers do not recommend utilizing the system()
tool, but that is ultimately up to you.