8273369: Computing micros between two instants unexpectedly overflows for some cases

Reviewed-by: lancea, rriggs, joehw
This commit is contained in:
Naoto Sato 2021-09-10 16:36:57 +00:00
parent efe3ed1e70
commit 81d2acee57
3 changed files with 52 additions and 6 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -182,14 +182,22 @@ public final class LocalTime
* Seconds per day.
*/
static final int SECONDS_PER_DAY = SECONDS_PER_HOUR * HOURS_PER_DAY;
/**
* Milliseconds per second.
*/
static final long MILLIS_PER_SECOND = 1000L;
/**
* Milliseconds per day.
*/
static final long MILLIS_PER_DAY = SECONDS_PER_DAY * 1000L;
static final long MILLIS_PER_DAY = MILLIS_PER_SECOND * SECONDS_PER_DAY;
/**
* Microseconds per second.
*/
static final long MICROS_PER_SECOND = 1000_000L;
/**
* Microseconds per day.
*/
static final long MICROS_PER_DAY = SECONDS_PER_DAY * 1000_000L;
static final long MICROS_PER_DAY = MICROS_PER_SECOND * SECONDS_PER_DAY;
/**
* Nanos per millisecond.
*/