hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jd...@apache.org
Subject svn commit: r1669376 [6/6] - in /hive/trunk: ant/src/org/apache/hadoop/hive/ant/ common/src/java/org/apache/hive/common/util/ common/src/test/org/apache/hive/common/util/ ql/src/gen/vectorization/ExpressionTemplates/ ql/src/java/org/apache/hadoop/hive/...
Date Thu, 26 Mar 2015 17:49:31 GMT
Modified: hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java
URL: http://svn.apache.org/viewvc/hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java?rev=1669376&r1=1669375&r2=1669376&view=diff
==============================================================================
--- hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java (original)
+++ hive/trunk/serde/src/java/org/apache/hadoop/hive/serde2/io/DateWritable.java Thu Mar 26
17:49:31 2015
@@ -134,11 +134,15 @@ public class DateWritable implements Wri
     return millisUtc - LOCAL_TIMEZONE.get().getOffset(tmp);
   }
 
+  public static int millisToDays(long millisLocal) {
+    long millisUtc = millisLocal + LOCAL_TIMEZONE.get().getOffset(millisLocal);
+    return (int)(millisUtc / MILLIS_PER_DAY);
+  }
+
   public static int dateToDays(Date d) {
     // convert to equivalent time in UTC, then get day offset
     long millisLocal = d.getTime();
-    long millisUtc = millisLocal + LOCAL_TIMEZONE.get().getOffset(millisLocal);
-    return (int)(millisUtc / MILLIS_PER_DAY);
+    return millisToDays(millisLocal);
   }
 
   public void setFromBytes(byte[] bytes, int offset, int length, VInt vInt) {



Mime
View raw message