This is the (pretty common, I'll add) code that you find for displaying the current in time in C and C++.
time_t tt;
struct tm * ti;
time (&tt);
ti = localtime(&tt);
cout << asctime(ti);
This is what I do understand:
- time_t is the data type that stores time values. tt is an object of that.
struct tm is a structure in the ctime header file.
I can't seem to wrap my head around what ti is. It seems to be a pointer object of tm, but why is the "struct" keyword being used here? Isn't tm an already existing structure?
What is time(&tt)? Storing the value of time in tt?