- strftime(date_time, 5, "%Y", localtime(&phdr->ts.secs));
- cv_hdr.year = GUINT16_TO_LE((guint16)strtol(date_time, NULL, 10));
-
- strftime(date_time, 5, "%m", localtime(&phdr->ts.secs));
- cv_hdr.month = (guint8)strtol(date_time, NULL, 10);
-
- strftime(date_time, 5, "%d", localtime(&phdr->ts.secs));
- cv_hdr.day = (guint8)strtol(date_time, NULL, 10);
-
- strftime(date_time, 5, "%H", localtime(&phdr->ts.secs));
- cv_hdr.hours = (guint8)strtol(date_time, NULL, 10);
-
- strftime(date_time, 5, "%M", localtime(&phdr->ts.secs));
- cv_hdr.minutes = (guint8)strtol(date_time, NULL, 10);
-
- strftime(date_time, 5, "%S", localtime(&phdr->ts.secs));
- cv_hdr.seconds = (guint8)strtol(date_time, NULL, 10);
-
+ tm = localtime(&phdr->ts.secs);
+ cv_hdr.year = tm->tm_year + 1900;
+ cv_hdr.month = tm->tm_mon + 1;
+ cv_hdr.day = tm->tm_mday;
+ cv_hdr.hours = tm->tm_hour;
+ cv_hdr.minutes = tm->tm_min;
+ cv_hdr.seconds = tm->tm_sec;