Set timezone compatible with previous version. Patch from N. Boullis.

This commit is contained in:
R. Bernstein
2012-03-12 05:53:07 -04:00
parent 2a6f153952
commit 03643c8621

View File

@@ -335,15 +335,17 @@ iso9660_set_dtime_with_timezone (const struct tm *p_tm,
Set time in format used in ISO 9660 directory index record Set time in format used in ISO 9660 directory index record
from a Unix time structure. */ from a Unix time structure. */
void void
iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date) iso9660_set_dtime(const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date)
{ {
int time_zone; int time_zone = 0;
if (p_tm) {
#ifdef HAVE_TM_GMTOFF #ifdef HAVE_TM_GMTOFF
/* Convert seconds to minutes */ /* Convert seconds to minutes */
time_zone = p_tm->tm_gmtoff / 60; time_zone = p_tm->tm_gmtoff / 60;
#else #else
time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; time_zone = (p_tm->tm_isdst > 0) ? -60 : 0;
#endif #endif
}
iso9660_set_dtime_with_timezone (p_tm, time_zone, p_idr_date); iso9660_set_dtime_with_timezone (p_tm, time_zone, p_idr_date);
} }
@@ -353,7 +355,7 @@ iso9660_set_dtime (const struct tm *p_tm, /*out*/ iso9660_dtime_t *p_idr_date)
correction in minutes. correction in minutes.
*/ */
void void
iso9660_set_ltime_with_timezone (const struct tm *p_tm, iso9660_set_ltime_with_timezone(const struct tm *p_tm,
int time_zone, int time_zone,
/*out*/ iso9660_ltime_t *pvd_date) /*out*/ iso9660_ltime_t *pvd_date)
{ {
@@ -388,15 +390,17 @@ iso9660_set_ltime_with_timezone (const struct tm *p_tm,
Set "long" time in format used in ISO 9660 primary volume descriptor Set "long" time in format used in ISO 9660 primary volume descriptor
from a Unix time structure. */ from a Unix time structure. */
void void
iso9660_set_ltime (const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date) iso9660_set_ltime(const struct tm *p_tm, /*out*/ iso9660_ltime_t *pvd_date)
{ {
int time_zone; int time_zone = 0;
if (p_tm) {
#ifdef HAVE_TM_GMTOFF #ifdef HAVE_TM_GMTOFF
/* Set time zone in 15-minute interval encoding. */ /* Set time zone in 15-minute interval encoding. */
time_zone = p_tm->tm_gmtoff / 60; time_zone = p_tm->tm_gmtoff / 60;
#else #else
time_zone = (p_tm->tm_isdst > 0) ? -60 : 0; time_zone = (p_tm->tm_isdst > 0) ? -60 : 0;
#endif #endif
}
iso9660_set_ltime_with_timezone (p_tm, time_zone, pvd_date); iso9660_set_ltime_with_timezone (p_tm, time_zone, pvd_date);
} }
@@ -666,8 +670,8 @@ iso9660_set_pvd(void *pd,
iso9660_set_ltime (&temp_tm, &(ipd.creation_date)); iso9660_set_ltime (&temp_tm, &(ipd.creation_date));
gmtime_r(pvd_time, &temp_tm); gmtime_r(pvd_time, &temp_tm);
iso9660_set_ltime (&temp_tm, &(ipd.modification_date)); iso9660_set_ltime (&temp_tm, &(ipd.modification_date));
iso9660_set_ltime (&temp_tm, &(ipd.expiration_date)); iso9660_set_ltime (NULL, &(ipd.expiration_date));
iso9660_set_ltime (&temp_tm, &(ipd.effective_date)); iso9660_set_ltime (NULL, &(ipd.effective_date));
ipd.file_structure_version = to_711(1); ipd.file_structure_version = to_711(1);