593 @Override
594 public long getLong(TemporalField field) {
595 if (field instanceof ChronoField) {
596 switch ((ChronoField) field) {
597 case NANO_OF_SECOND: return nanos;
598 case MICRO_OF_SECOND: return nanos / 1000;
599 case MILLI_OF_SECOND: return nanos / 1000_000;
600 case INSTANT_SECONDS: return seconds;
601 }
602 throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
603 }
604 return field.getFrom(this);
605 }
606
607 //-----------------------------------------------------------------------
608 /**
609 * Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
610 * <p>
611 * The epoch second count is a simple incrementing count of seconds where
612 * second 0 is 1970-01-01T00:00:00Z.
613 * The nanosecond part of the day is returned by {@link #getNano}.
614 *
615 * @return the seconds from the epoch of 1970-01-01T00:00:00Z
616 */
617 public long getEpochSecond() {
618 return seconds;
619 }
620
621 /**
622 * Gets the number of nanoseconds, later along the time-line, from the start
623 * of the second.
624 * <p>
625 * The nanosecond-of-second value measures the total number of nanoseconds from
626 * the second returned by {@link #getEpochSecond}.
627 *
628 * @return the nanoseconds within the second, always positive, never exceeds 999,999,999
629 */
630 public int getNano() {
631 return nanos;
632 }
633
|
593 @Override
594 public long getLong(TemporalField field) {
595 if (field instanceof ChronoField) {
596 switch ((ChronoField) field) {
597 case NANO_OF_SECOND: return nanos;
598 case MICRO_OF_SECOND: return nanos / 1000;
599 case MILLI_OF_SECOND: return nanos / 1000_000;
600 case INSTANT_SECONDS: return seconds;
601 }
602 throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
603 }
604 return field.getFrom(this);
605 }
606
607 //-----------------------------------------------------------------------
608 /**
609 * Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z.
610 * <p>
611 * The epoch second count is a simple incrementing count of seconds where
612 * second 0 is 1970-01-01T00:00:00Z.
613 * The nanosecond part is returned by {@link #getNano}.
614 *
615 * @return the seconds from the epoch of 1970-01-01T00:00:00Z
616 */
617 public long getEpochSecond() {
618 return seconds;
619 }
620
621 /**
622 * Gets the number of nanoseconds, later along the time-line, from the start
623 * of the second.
624 * <p>
625 * The nanosecond-of-second value measures the total number of nanoseconds from
626 * the second returned by {@link #getEpochSecond}.
627 *
628 * @return the nanoseconds within the second, always positive, never exceeds 999,999,999
629 */
630 public int getNano() {
631 return nanos;
632 }
633
|