iso9960, exfat, fat: Corrected time conversion mistakes.
* Fixes #9524 * Some style cleanup Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
This commit is contained in:
parent
1152f6eca6
commit
a3fdd62c13
@ -270,9 +270,11 @@ Inode::_GetTimespec(uint16 date, uint16 time, struct timespec ×pec) const
|
||||
if (tzoffset == -1)
|
||||
tzoffset = get_timezone_offset() / 60;
|
||||
|
||||
time_t days = daze[(date>>5)&15] + ((date>>9)+10)*365 + leaps((date>>9)+10,((date>>5)&15)-1)+(date&31)-1;
|
||||
time_t days = daze[(date >> 5) & 15] + ((date >> 9) + 10) * 365
|
||||
+ leaps((date >> 9) + 10, ((date >> 5) & 15) - 1) + (date & 31) -1;
|
||||
|
||||
timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time>>5)&63) + tzoffset) * 60 + 2*(time&31);
|
||||
timespec.tv_sec = ((days * 24 + (time >> 11)) * 60 + ((time >> 5) & 63)
|
||||
- tzoffset) * 60 + 2 * (time & 31);
|
||||
timespec.tv_nsec = 0;
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ dos2time_t(uint32 t)
|
||||
|
||||
days = daze[(t>>21)&15] + ((t>>25)+10)*365 + leaps((t>>25)+10,((t>>21)&15)-1)+((t>>16)&31)-1;
|
||||
|
||||
return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) + tzoffset) * 60 + 2*(t&31);
|
||||
return (((days * 24) + ((t>>11)&31)) * 60 + ((t>>5)&63) - tzoffset) * 60 + 2*(t&31);
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ time_t2dos(time_t s)
|
||||
|
||||
get_tzoffset();
|
||||
|
||||
t = (s % 60) / 2; s /= 60; s -= tzoffset;
|
||||
t = (s % 60) / 2; s /= 60; s += tzoffset;
|
||||
t += (s % 60) << 5; s /= 60;
|
||||
t += (s % 24) << 11;s /= 24;
|
||||
|
||||
|
@ -975,7 +975,7 @@ ConvertRecDate(ISORecDate* inDate, time_t* outDate)
|
||||
time_t time;
|
||||
int days, i, year, tz;
|
||||
|
||||
year = inDate->year -70;
|
||||
year = inDate->year - 70;
|
||||
tz = inDate->offsetGMT;
|
||||
|
||||
if (year < 0) {
|
||||
@ -1002,7 +1002,7 @@ ConvertRecDate(ISORecDate* inDate, time_t* outDate)
|
||||
tz |= (-1 << 8);
|
||||
|
||||
if (-48 <= tz && tz <= 52)
|
||||
time += tz *15 * 60;
|
||||
time -= tz * 15 * 60;
|
||||
}
|
||||
*outDate = time;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user