Im not all lost (I hope) but I do not understand the use of
std::time(0), could anyone please explain
exactly what it does as the program compiles without the
use of that function... but the time it displays is not correct.
(This actually gives a hint about the importantness of std::time(0)
but what I want is an accurate description).
Code:
#include <iostream>
#include <ctime>
int main()
{
int hour, min, sec;
time_t now=std::time(0);
tm *thetime = std::localtime(&now);
hour = thetime->tm_hour;
min = thetime->tm_min;
sec = thetime->tm_sec;
cout << hour << ':' << min << ':' << sec;
}