http://rabbit.eng.miami.edu/info/functions/time.html#localtime :
tm * localtime(time_t * tim) tm * gmtime(time_t * tim) tm * localtime_r(time_t * tim, tm * output) tm * gmtime_r(time_t * tim, tm * output) struct tm * localtime(time_t * tim) in C struct tm * gmtime(time_t * tim) in C struct tm * localtime_r(time_t * tim, struct tm * output) in C struct tm * gmtime_r(time_t * tim, struct tm * output) in C include: The parameter is a pointer to a time_t (effectively an int) variable containing the time in seconds since 1/1/1970. The represented time is analysed to produce all the components: hour, minute, second, day, month, year, day-of-week, time zone. Those values are stored in a tm structure, and a pointer to that structure is returned. All calls to localtime and gmtime use the same static structure, so each call overwrites the results of the previous call. Localtime uses the local time zone, gmtime converts to GMT (or UTC). Localtime_r and gmtime_r are exactly the same as localtime and gmtime, except that the caller must provide a pointer to an existing tm object, and the components of that object will be filled in; the return result is the same as the second parameter. time_t values are produced from the clock by time. tm structures are converted to strings by asctime. Example:
time_t tim=time(NULL); tm *now=localtime(&tim); printf("Date is %d/%02d/%02d\n", now->tm_year+1900, now->tm_mon+1, now->tm_mday); printf("Time is %02d:%02d\n", now->tm_hour, now->tm_min);
Rather then printing a date, you would store it into a string.. and then use that (string) for your file-name