Hi, i've started to use time.h and i'm needing help with something.. basically, i want to be able to return the specified number of seconds in a week/day/hour/minute/second format very similar to that of mIRC's $duration().
I've done it before but I can't remember what I did.. i know how to get the ctime C++
time_t seconds; seconds = time (NULL); printf ("%d seconds since January 1, 1970\n", seconds);
It would be the same thing as doing this in mIRC
//echo -a $ctime
So, I know how to get the ctime and calculate it down to how many seconds i have.. but i don't know how to convert it to a week/day/hour/minute/second format.. like this in mIRC
//echo -a $duration($calc($ctime - 1139796581))
which returns 1hr 46mins 24secs for me.
So I have the number of seconds from ctime 6384 - but i need to convert those seconds to 1hr 46mins 24secs.
Any help would be appreciated, i've been trying to figure it out all day with different combinations of asctime, time, localtime, etc.. and i can't figure it out.