orc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From omalley <...@git.apache.org>
Subject [GitHub] orc pull request #220: ORC-306 Correct pre-1970 timestamps that were off by ...
Date Wed, 28 Feb 2018 03:02:12 GMT
Github user omalley commented on a diff in the pull request:

    https://github.com/apache/orc/pull/220#discussion_r171132343
  
    --- Diff: java/core/src/java/org/apache/orc/impl/TreeReaderFactory.java ---
    @@ -49,6 +50,15 @@
      * Factory for creating ORC tree readers.
      */
     public class TreeReaderFactory {
    +  // The current JDK has a bug where values of the form:
    +  // YYYY-MM-DD HH:MM:SS.000X is off by a second for dates before 1970.
    +  public static final boolean TIMESTAMP_BUG;
    +  static {
    +    Timestamp ts1 = Timestamp.valueOf("1969-12-25 12:34:56.0001");
    +    Timestamp ts2 = Timestamp.valueOf("1969-12-25 12:34:56.0011");
    +    // Compare the seconds, which should be the same.
    +    TIMESTAMP_BUG = ts1.getTime()/1000 != ts2.getTime()/1000;
    --- End diff --
    
    getTime() returns the milliseconds after 1970-01-01 00:00:00. So getTime()/1000 should
return the seconds, which should be the same.


---

Mime
View raw message