2929 * broken into two components microseconds and nanoFractions, where nanoFractions can range from
3030 * [-999, 999]. Internally, Spanner supports Interval value with the following range of individual
3131 * fields: months: [-120000, 120000] days: [-3660000, 3660000] nanoseconds: [-316224000000000000000,
32- * 316224000000000000000] Interval value created outside the specified domain will return error when
32+ * 316224000000000000000]. Interval value created outside the specified domain will return error when
3333 * sent to Spanner backend.
3434 */
3535@ Immutable
@@ -43,21 +43,19 @@ public class Interval implements Serializable {
4343 public static final long SECONDS_PER_MINUTE = 60 ;
4444 public static final long SECONDS_PER_HOUR = MINUTES_PER_HOUR * SECONDS_PER_MINUTE ;
4545 public static final long MILLIS_PER_SECOND = 1000 ;
46- public static final long MICROS_PER_MILLI = 1000 ;
47- public static final long NANOS_PER_MICRO = 1000 ;
48- public static final long MICROS_PER_SECOND = MICROS_PER_MILLI * MILLIS_PER_SECOND ;
46+ public static final long MICROS_PER_MILLISECOND = 1000 ;
47+ public static final long MICROS_PER_SECOND = MICROS_PER_MILLISECOND * MILLIS_PER_SECOND ;
4948 public static final long MICROS_PER_MINUTE = SECONDS_PER_MINUTE * MICROS_PER_SECOND ;
5049 public static final long MICROS_PER_HOUR = SECONDS_PER_HOUR * MICROS_PER_SECOND ;
51- public static final BigInteger NANOS_PER_MICROSECOND =
52- BigInteger .valueOf (MICROS_PER_SECOND * NANOS_PER_MICRO );
50+ public static final long NANOS_PER_MICROSECOND = 1000 ;
5351 public static final BigInteger NANOS_PER_MILLISECOND =
54- BigInteger .valueOf (MILLIS_PER_SECOND * NANOS_PER_MICRO );
52+ BigInteger .valueOf (MICROS_PER_MILLISECOND * NANOS_PER_MICROSECOND );
5553 public static final BigInteger NANOS_PER_SECOND =
56- BigInteger .valueOf (MICROS_PER_SECOND * NANOS_PER_MICRO );
54+ BigInteger .valueOf (MICROS_PER_SECOND * NANOS_PER_MICROSECOND );
5755 public static final BigInteger NANOS_PER_MINUTE =
58- BigInteger .valueOf (MICROS_PER_MINUTE * NANOS_PER_MICRO );
56+ BigInteger .valueOf (MICROS_PER_MINUTE * NANOS_PER_MICROSECOND );
5957 public static final BigInteger NANOS_PER_HOUR =
60- BigInteger .valueOf (MICROS_PER_HOUR * NANOS_PER_MICRO );
58+ BigInteger .valueOf (MICROS_PER_HOUR * NANOS_PER_MICROSECOND );
6159 public static final Interval ZERO = Interval .builder ().build ();
6260
6361 /** Regex to parse ISO8601 interval format- `P[n]Y[n]M[n]DT[n]H[n]M[n([.,][fraction])]S` */
@@ -115,7 +113,7 @@ public static Interval ofMilliseconds(long milliseconds) {
115113 /** Creates an interval with specified number of microseconds. */
116114 public static Interval ofMicroseconds (long micros ) {
117115 return builder ()
118- .setNanoseconds (BigInteger .valueOf (micros ).multiply (NANOS_PER_MICROSECOND ))
116+ .setNanoseconds (BigInteger .valueOf (micros ).multiply (BigInteger . valueOf ( NANOS_PER_MICROSECOND ) ))
119117 .build ();
120118 }
121119
0 commit comments