diff -r de746e7eb1e3 -r bc3eacb42ab1 jdk/src/java.base/share/classes/java/time/LocalTime.java --- a/jdk/src/java.base/share/classes/java/time/LocalTime.java Fri Dec 18 17:42:06 2015 +0100 +++ b/jdk/src/java.base/share/classes/java/time/LocalTime.java Wed Dec 23 13:19:58 2015 -0500 @@ -1490,6 +1490,30 @@ return total; } + /** + * Converts this {@code LocalTime} to the number of seconds since the epoch + * of 1970-01-01T00:00:00Z. + *
+ * This combines this local time with the specified date and + * offset to calculate the epoch-second value, which is the + * number of elapsed seconds from 1970-01-01T00:00:00Z. + * Instants on the time-line after the epoch are positive, earlier + * are negative. + * + * @param date the local date, not null + * @param offset the zone offset, not null + * @return the number of seconds since the epoch of 1970-01-01T00:00:00Z, may be negative + * @since 9 + */ + public long toEpochSecond(LocalDate date, ZoneOffset offset) { + Objects.requireNonNull(date, "date"); + Objects.requireNonNull(offset, "offset"); + long epochDay = date.toEpochDay(); + long secs = epochDay * 86400 + toSecondOfDay(); + secs -= offset.getTotalSeconds(); + return secs; + } + //----------------------------------------------------------------------- /** * Compares this time to another time.