Refine search
@Override public Void visit(ScalarTime value, StringBuilder arg) { arg.append('\'') //this prints the value on ISO-8601, which is the recommended format on PostgreSQL .append(value.getValue().toString()) .append('\''); return null; }
/** * Is the transition local time midnight at the end of day. * <p> * The transition may be represented as occurring at 24:00. * * @return whether a local time of midnight is at the start or end of the day */ public boolean isMidnightEndOfDay() { return adjustDays == 1 && time.equals(LocalTime.MIDNIGHT); }
/** * Obtains an instance of {@code LocalTime} from a text string such as {@code 10:15}. * <p> * The string must represent a valid time and is parsed using * {@link org.threeten.bp.format.DateTimeFormatter#ISO_LOCAL_TIME}. * * @param text the text to parse such as "10:15:30", not null * @return the parsed local time, not null * @throws DateTimeParseException if the text cannot be parsed */ public static LocalTime parse(CharSequence text) { return parse(text, DateTimeFormatter.ISO_LOCAL_TIME); }
/** * Converts a {@code LocalTime} to a {@code java.sql.Time}. * * @param time the local time, not null * @return the SQL time, not null */ @SuppressWarnings("deprecation") public static java.sql.Time toSqlTime(LocalTime time) { return new java.sql.Time(time.getHour(), time.getMinute(), time.getSecond()); }
@Override public void serialize(LocalTime value, JsonGenerator g, SerializerProvider provider) throws IOException { if (useTimestamp(provider)) { g.writeStartArray(); g.writeNumber(value.getHour()); g.writeNumber(value.getMinute()); if(value.getSecond() > 0 || value.getNano() > 0) { g.writeNumber(value.getSecond()); if(value.getNano() > 0) { if(provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)) g.writeNumber(value.getNano()); else g.writeNumber(value.get(ChronoField.MILLI_OF_SECOND)); } } g.writeEndArray(); } else { DateTimeFormatter dtf = _formatter; if (dtf == null) { dtf = _defaultFormatter(); } g.writeString(value.format(dtf)); } }
/** * A hash code for this time. * * @return a suitable hash code */ @Override public int hashCode() { return time.hashCode() ^ offset.hashCode(); }
@Override public Long convert(LocalTime source) { return source.getLong(ChronoField.MILLI_OF_DAY); } }
@Override public long getLong(TemporalField field) { Jdk8Methods.requireNonNull(field, "field"); Long value = getFieldValue0(field); if (value == null) { if (date != null && date.isSupported(field)) { return date.getLong(field); } if (time != null && time.isSupported(field)) { return time.getLong(field); } throw new DateTimeException("Field not found: " + field); } return value; }
final int timeSecs = time.toSecondOfDay() + adjustDays * SECS_PER_DAY; final int stdOffset = standardOffset.getTotalSeconds(); final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset; final int afterDiff = offsetAfter.getTotalSeconds() - stdOffset; final int timeByte = (timeSecs % 3600 == 0 && timeSecs <= SECS_PER_DAY ? (timeSecs == SECS_PER_DAY ? 24 : time.getHour()) : 31); final int stdOffsetByte = (stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255); final int beforeByte = (beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
/** * Gets the hour-of-day field. * * @return the hour-of-day, from 0 to 23 */ public int getHour() { return time.getHour(); }
public int get(TemporalField field) { if (field instanceof ChronoField) { return (field.isTimeBased() ? time.get(field) : date.get(field));
/** * Gets the minute-of-hour field. * * @return the minute-of-hour, from 0 to 59 */ public int getMinute() { return time.getMinute(); }
@Override public BsonValue<?> visit(KVTime value, Void arg) { List<Entry<?>> entryList = new ArrayList<>(2); entryList.add(new SimpleEntry<>("type", newString("KVTime"))); entryList.add(new SimpleEntry<>("value", newString(value.getValue().format(DateTimeFormatter.ISO_TIME)))); return newDocument(entryList); }
/** * Converts a {@code LocalTime} to a {@code java.sql.Time}. * * @param time the local time, not null * @return the SQL time, not null */ @SuppressWarnings("deprecation") public static java.sql.Time toSqlTime(LocalTime time) { return new java.sql.Time(time.getHour(), time.getMinute(), time.getSecond()); }
/** * A hash code for this date-time. * * @return a suitable hash code */ @Override public int hashCode() { return date.hashCode() ^ time.hashCode(); }
@Override public long getLong(TemporalField field) { if (field instanceof ChronoField) { return (field.isTimeBased() ? time.getLong(field) : date.getLong(field)); } return field.getFrom(this); }
@Override public long getLong(TemporalField field) { Jdk8Methods.requireNonNull(field, "field"); Long value = getFieldValue0(field); if (value == null) { if (date != null && date.isSupported(field)) { return date.getLong(field); } if (time != null && time.isSupported(field)) { return time.getLong(field); } throw new DateTimeException("Field not found: " + field); } return value; }
final int timeSecs = time.toSecondOfDay() + adjustDays * SECS_PER_DAY; final int stdOffset = standardOffset.getTotalSeconds(); final int beforeDiff = offsetBefore.getTotalSeconds() - stdOffset; final int afterDiff = offsetAfter.getTotalSeconds() - stdOffset; final int timeByte = (timeSecs % 3600 == 0 && timeSecs <= SECS_PER_DAY ? (timeSecs == SECS_PER_DAY ? 24 : time.getHour()) : 31); final int stdOffsetByte = (stdOffset % 900 == 0 ? stdOffset / 900 + 128 : 255); final int beforeByte = (beforeDiff == 0 || beforeDiff == 1800 || beforeDiff == 3600 ? beforeDiff / 1800 : 3);
/** * Gets the hour-of-day field. * * @return the hour-of-day, from 0 to 23 */ public int getHour() { return time.getHour(); }
@Override public int get(TemporalField field) { if (field instanceof ChronoField) { return (field.isTimeBased() ? time.get(field) : date.get(field)); } return range(field).checkValidIntValue(getLong(field), field); }