Kaydet (Commit) 4d220882 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

hair splitting on years in dates in ZIP structure

Change-Id: I9d7a6436e3df75eff592d19dcaca0f655ebf2160
üst 6e82772d
......@@ -450,12 +450,25 @@ sal_uInt32 ZipOutputStream::getCurrentDosTime( )
osl_getSystemTime ( &aTimeValue );
osl_getDateTimeFromTimeValue( &aTimeValue, &aDateTime);
// at year 2108, there is an overflow
// -> some decision needs to be made
// how to handle the ZIP file format (just overflow?)
// if the current system time is before 1980,
// then the time traveller will have to make a decision
// how to handle the ZIP file format before it is invented
// (just underflow?)
assert(aDateTime.Year > 1980 && aDateTime.Year < 2108);
sal_uInt32 nYear = static_cast <sal_uInt32> (aDateTime.Year);
if (nYear>1980)
if (nYear>=1980)
nYear-=1980;
else if (nYear>80)
else if (nYear>=80)
{
nYear-=80;
}
sal_uInt32 nResult = static_cast < sal_uInt32>( ( ( ( aDateTime.Day) +
( 32 * (aDateTime.Month)) +
( 512 * nYear ) ) << 16) |
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment