public static long getTimePartitionIdWithoutOverflow(long time) {
    BigInteger bigTime = BigInteger.valueOf(time).subtract(bigTimePartitionOrigin);
    BigInteger partitionId =
        bigTime.compareTo(BigInteger.ZERO) > 0
                || bigTime.remainder(bigTimePartitionInterval).equals(BigInteger.ZERO)
            ? bigTime.divide(bigTimePartitionInterval)
            : bigTime.divide(bigTimePartitionInterval).subtract(BigInteger.ONE);
    return partitionId.longValue();
  }
Time range for dividing database, the time unit is the same with IoTDB's TimestampPrecision
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/utils/TimePartitionUtils.java