public static long millisToSeconds(long millis) {
    if (millis >= 0) {
      return millis / 1000;
    } else {
      return (millis - 999) / 1000;
    }
  }
Rounds the number of milliseconds relative to the epoch down to the nearest whole number of
seconds. 500 would round to 0, -500 would round to -1.
common/src/java/org/apache/hadoop/hive/common/type/TimestampUtils.java