how to get time (year,month,day,minute,second) with libpng

I have a struct of this type and need to set the values for the struct:

1
2
3
4
5
6
7
8
9
10
11
12
typedef unsigned char png_byte;
typedef unsigned short png_uint_16;
typedef struct png_time_struct
{
   png_uint_16 year; /* full year, as in, 1995 */
   png_byte month;   /* month of year, 1 - 12 */
   png_byte day;     /* day of month, 1 - 31 */
   png_byte hour;    /* hour of day, 0 - 23 */
   png_byte minute;  /* minute of hour, 0 - 59 */
   png_byte second;  /* second of minute, 0 - 60 (for leap seconds) */
} png_time;
png_time mod_time;


But I don't know how to get these values of current time - year, month, day,hour, minute, second to the mod_time struct?
Last edited on
I have found (here: http://www.libpng.org/pub/png/book/chapter15.html) solution inside the library which I use (libpng) there is function for it to fill the struct with values:

1
2
3
4
time_t mtime;
mtime = time(NULL);
png_convert_from_time_t(&data->mod_time, mtime);
png_set_tIME(png_ptr, info_ptr, &data->mod_time);
Topic archived. No new replies allowed.