pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1601416 - /pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
Date Mon, 09 Jun 2014 15:58:05 GMT
Author: tilman
Date: Mon Jun  9 15:58:04 2014
New Revision: 1601416

URL: http://svn.apache.org/r1601416
Log:
PDFBOX-2122: use UTC timezone for readInternationalDate, as suggested by Tim Allison

Modified:
    pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java

Modified: pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java?rev=1601416&r1=1601415&r2=1601416&view=diff
==============================================================================
--- pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java (original)
+++ pdfbox/trunk/fontbox/src/main/java/org/apache/fontbox/ttf/TTFDataStream.java Mon Jun 
9 15:58:04 2014
@@ -22,6 +22,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.util.Calendar;
 import java.util.GregorianCalendar;
+import java.util.TimeZone;
 
 /**
  * An interface into a data stream.
@@ -194,7 +195,9 @@ public abstract class TTFDataStream impl
     public Calendar readInternationalDate() throws IOException
     {
         long secondsSince1904 = readLong();
-        GregorianCalendar cal = new GregorianCalendar(1904, 0, 1);
+        Calendar cal = GregorianCalendar.getInstance(TimeZone.getTimeZone("UTC"));
+        cal.set(1904, 0, 1, 0, 0, 0);
+        cal.set(Calendar.MILLISECOND, 0);
         long millisFor1904 = cal.getTimeInMillis();
         millisFor1904 += (secondsSince1904 * 1000);
         cal.setTimeInMillis(millisFor1904);



Mime
View raw message