Fixed a bug reading timestamps wrongly sometimes, placing the files'

times in the Middle Ages. And no, neither Microsoft nor POI existed
back then.


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353006 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Rainer Klute 2003-02-13 16:57:39 +00:00
parent caf032a84f
commit 90e630a955

View File

@ -176,7 +176,7 @@ public class Util
* file. The structure identifies a 64-bit integer specifying the * file. The structure identifies a 64-bit integer specifying the
* number of 100-nanosecond intervals which have passed since * number of 100-nanosecond intervals which have passed since
* January 1, 1601. This 64-bit value is split into the two double * January 1, 1601. This 64-bit value is split into the two double
* word stored in the structure.</p> * words stored in the structure.</p>
* *
* @param high The higher double word of the FILETIME structure. * @param high The higher double word of the FILETIME structure.
* @param low The lower double word of the FILETIME structure. * @param low The lower double word of the FILETIME structure.
@ -184,7 +184,7 @@ public class Util
*/ */
public static Date filetimeToDate(final int high, final int low) public static Date filetimeToDate(final int high, final int low)
{ {
final long filetime = ((long) high) << 32 | ((long) low); final long filetime = ((long) high) << 32 | (low & 0xffffffffL);
final long ms_since_16010101 = filetime / (1000 * 10); final long ms_since_16010101 = filetime / (1000 * 10);
final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF; final long ms_since_19700101 = ms_since_16010101 - EPOCH_DIFF;
return new Date(ms_since_19700101); return new Date(ms_since_19700101);