Question:
I am trying to write a program that provides a constructor that’s capable of using the current time from the time() function declared in the C standard library header
Answer:
It’s very simple, actually.
time() returns a time_t, which is really the number of seconds elasped since00:00:00.0 1 January 1970.
The trick is to pass this value to localtime(). This returns a struct tm alsodefined in time.h, which has all the goodies inside it. Take a look at time.h; also, read the man pages for localtime.