src/java.base/share/classes/java/time/LocalTime.java

Print this page
rev 12809 : 8023217: Additional floorDiv/floorMod/multiplyExact methods for java.lang.Math
Summary: Add new methods with long, int signatures.
Reviewed-by: XXX

*** 1,7 **** /* ! * Copyright (c) 2012, 2013, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2015, 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 * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 274,284 **** Objects.requireNonNull(clock, "clock"); // inline OffsetTime factory to avoid creating object and InstantProvider checks final Instant now = clock.instant(); // called once ZoneOffset offset = clock.getZone().getRules().getOffset(now); long localSecond = now.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later ! int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY); return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano()); } //----------------------------------------------------------------------- /** --- 274,284 ---- Objects.requireNonNull(clock, "clock"); // inline OffsetTime factory to avoid creating object and InstantProvider checks final Instant now = clock.instant(); // called once ZoneOffset offset = clock.getZone().getRules().getOffset(now); long localSecond = now.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later ! int secsOfDay = Math.floorMod(localSecond, SECONDS_PER_DAY); return ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + now.getNano()); } //----------------------------------------------------------------------- /**