java.time.LocalTime#getMinute ( )源码实例Demo

下面列出了java.time.LocalTime#getMinute ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk8u-jdk   文件: TCKLocalizedPrinterParser.java
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_parse(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    TemporalAccessor parsed = f.parse(text, pos);
    assertEquals(pos.getIndex(), text.length());
    assertEquals(pos.getErrorIndex(), -1);
    assertEquals(LocalTime.from(parsed), time);
}
 
源代码2 项目: flink   文件: LocalTimeComparator.java
public static void putNormalizedKeyLocalTime(LocalTime record, MemorySegment target, int offset, int numBytes) {
	int hour = record.getHour();
	if (numBytes > 0) {
		target.put(offset, (byte) (hour & 0xff - Byte.MIN_VALUE));
		numBytes -= 1;
		offset += 1;
	}

	int minute = record.getMinute();
	if (numBytes > 0) {
		target.put(offset, (byte) (minute & 0xff - Byte.MIN_VALUE));
		numBytes -= 1;
		offset += 1;
	}

	int second = record.getSecond();
	if (numBytes > 0) {
		target.put(offset, (byte) (second & 0xff - Byte.MIN_VALUE));
		numBytes -= 1;
		offset += 1;
	}

	int nano = record.getNano();
	int unsignedNano = nano - Integer.MIN_VALUE;
	if (numBytes >= 4) {
		target.putIntBigEndian(offset, unsignedNano);
		numBytes -= 4;
		offset += 4;
	} else if (numBytes > 0) {
		for (int i = 0; numBytes > 0; numBytes--, i++) {
			target.put(offset + i, (byte) (unsignedNano >>> ((3 - i) << 3)));
		}
		return;
	}

	for (int i = 0; i < numBytes; i++) {
		target.put(offset + i, (byte) 0);
	}
}
 
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_print(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    String formatted = f.format(time);
    assertEquals(formatted, text);
}
 
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_parse(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    TemporalAccessor parsed = f.parse(text, pos);
    assertEquals(pos.getIndex(), text.length());
    assertEquals(pos.getErrorIndex(), -1);
    assertEquals(LocalTime.from(parsed), time);
}
 
源代码5 项目: openjdk-jdk9   文件: TCKLocalizedPrinterParser.java
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_parse(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    TemporalAccessor parsed = f.parse(text, pos);
    assertEquals(pos.getIndex(), text.length());
    assertEquals(pos.getErrorIndex(), -1);
    assertEquals(LocalTime.from(parsed), time);
}
 
源代码6 项目: Medusa   文件: Helper.java
public static final void drawTimeSections(final Clock CLOCK, final GraphicsContext CTX, final List<TimeSection> SECTIONS, final double SIZE,
                                          final double XY_INSIDE, final double XY_OUTSIDE, final double WH_INSIDE, final double WH_OUTSIDE,
                                          final double LINE_WIDTH) {
    if (SECTIONS.isEmpty()) return;
    TickLabelLocation tickLabelLocation = CLOCK.getTickLabelLocation();
    ZonedDateTime     time              = CLOCK.getTime();
    boolean           isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
    double            xy                = TickLabelLocation.INSIDE == tickLabelLocation ? XY_INSIDE * SIZE : XY_OUTSIDE * SIZE;
    double            wh                = TickLabelLocation.INSIDE == tickLabelLocation ? WH_INSIDE * SIZE : WH_OUTSIDE * SIZE;
    double            offset            = 90;
    int               listSize          = SECTIONS.size();
    double            angleStep         = 360.0 / 60.0;
    boolean           highlightSections = CLOCK.isHighlightSections();
    for (int i = 0 ; i < listSize ; i++) {
        TimeSection section   = SECTIONS.get(i);
        LocalTime   start     = section.getStart();
        LocalTime   stop      = section.getStop();
        boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     draw      = isAM ? (isStartAM || isStopAM) :(!isStartAM || !isStopAM);
        if (draw) {
            double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
            double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
            //TODO: Add an indicator to the section like -1 or similar
            // check if start was already yesterday
            if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }
            CTX.save();
            if (highlightSections) {
                CTX.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
            } else {
                CTX.setStroke(section.getColor());
            }
            CTX.setLineWidth(SIZE * LINE_WIDTH);
            CTX.setLineCap(StrokeLineCap.BUTT);
            CTX.strokeArc(xy, xy, wh, wh, -(offset + sectionStartAngle), -sectionAngleExtend, ArcType.OPEN);
            CTX.restore();
        }
    }
}
 
源代码7 项目: runelite   文件: PrayerPlugin.java
String getEstimatedTimeRemaining(boolean formatForOrb)
{
	final double drainRate = getPrayerDrainRate(client);

	if (drainRate == 0)
	{
		return "N/A";
	}

	final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER);

	// Calculate how many seconds each prayer points last so the prayer bonus can be applied
	final double secondsPerPoint = (60.0 / drainRate) * (1.0 + (prayerBonus / 30.0));

	// Calculate the number of seconds left
	final double secondsLeft = (currentPrayer * secondsPerPoint);

	LocalTime timeLeft = LocalTime.ofSecondOfDay((long) secondsLeft);

	if (formatForOrb && timeLeft.getMinute() > 9)
	{
		return timeLeft.format(DateTimeFormatter.ofPattern("m")) + "m";
	}
	else
	{
		return timeLeft.format(DateTimeFormatter.ofPattern("m:ss"));
	}
}
 
源代码8 项目: jdk8u-jdk   文件: TCKLocalizedPrinterParser.java
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_print(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    String formatted = f.format(time);
    assertEquals(formatted, text);
}
 
源代码9 项目: openjdk-8   文件: TCKLocalizedPrinterParser.java
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_print(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    String formatted = f.format(time);
    assertEquals(formatted, text);
}
 
源代码10 项目: jdk8u-jdk   文件: TCKLocalizedPrinterParser.java
@SuppressWarnings("deprecation")
@Test(dataProvider="time")
public void test_time_parse(LocalTime time, FormatStyle timeStyle, int timeStyleOld, Locale locale) {
    DateFormat old = DateFormat.getTimeInstance(timeStyleOld, locale);
    Date oldDate = new Date(1970, 0, 0, time.getHour(), time.getMinute(), time.getSecond());
    String text = old.format(oldDate);

    DateTimeFormatter f = builder.appendLocalized(null, timeStyle).toFormatter(locale);
    TemporalAccessor parsed = f.parse(text, pos);
    assertEquals(pos.getIndex(), text.length());
    assertEquals(pos.getErrorIndex(), -1);
    assertEquals(LocalTime.from(parsed), time);
}
 
源代码11 项目: jdk8u_jdk   文件: JavatimeTest.java
private static boolean isEqual(LocalTime lt, java.sql.Time t) {
    return lt.getHour() == t.getHours() &&
           lt.getMinute() == t.getMinutes() &&
           lt.getSecond() == t.getSeconds();
}
 
源代码12 项目: alibaba-rsocket-broker   文件: LocalTimeHandle.java
public LocalTimeHandle(LocalTime o) {
    this.hour = o.getHour();
    this.minute = o.getMinute();
    this.second = o.getSecond();
    this.nano = o.getNano();
}
 
源代码13 项目: openjdk-jdk9   文件: JavatimeTest.java
private static boolean isEqual(LocalTime lt, java.sql.Time t) {
    return lt.getHour() == t.getHours() &&
           lt.getMinute() == t.getMinutes() &&
           lt.getSecond() == t.getSeconds();
}
 
源代码14 项目: tilesfx   文件: TimerControlTileSkin.java
private void drawTimeSections() {
    if (sectionMap.isEmpty()) return;
    ZonedDateTime time              = tile.getTime();
    DayOfWeek     day               = time.getDayOfWeek();
    boolean       isAM              = time.get(ChronoField.AMPM_OF_DAY) == 0;
    double        offset            = 90;
    double        angleStep         = 360.0 / 60.0;
    boolean       highlightSections = tile.isHighlightSections();
    for (TimeSection section : sectionMap.keySet()) {
        LocalTime   start     = section.getStart();
        LocalTime   stop      = section.getStop();
        boolean     isStartAM = start.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     isStopAM  = stop.get(ChronoField.AMPM_OF_DAY) == 0;
        boolean     draw      = isAM ? (isStartAM || isStopAM) : (!isStartAM || !isStopAM);
        if (!section.getDays().contains(day)) { draw = false; }
        if (!section.isActive()) { draw = false; }
        if (draw) {
            double sectionStartAngle = (start.getHour() % 12 * 5.0 + start.getMinute() / 12.0 + start.getSecond() / 300.0) * angleStep + 180;
            double sectionAngleExtend = ((stop.getHour() - start.getHour()) % 12 * 5.0 + (stop.getMinute() - start.getMinute()) / 12.0 + (stop.getSecond() - start.getSecond()) / 300.0) * angleStep;
            if (start.getHour() > stop.getHour()) { sectionAngleExtend = (360.0 - Math.abs(sectionAngleExtend)); }

            Arc arc = sectionMap.get(section);
            arc.setCenterX(clockSize * 0.5);
            arc.setCenterY(clockSize * 0.5);
            arc.setRadiusX(clockSize * 0.45);
            arc.setRadiusY(clockSize * 0.45);
            arc.setStartAngle(-(offset + sectionStartAngle));
            arc.setLength(-sectionAngleExtend);
            arc.setType(ArcType.OPEN);
            arc.setStrokeWidth(clockSize * 0.04);
            arc.setStrokeLineCap(StrokeLineCap.BUTT);
            arc.setFill(null);

            if (highlightSections) {
                arc.setStroke(section.contains(time.toLocalTime()) ? section.getHighlightColor() : section.getColor());
            } else {
                arc.setStroke(section.getColor());
            }
        }
    }
}
 
源代码15 项目: jdk1.8-source-analysis   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}
 
源代码17 项目: jdk8u_jdk   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}
 
源代码18 项目: openjdk-jdk9   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}. The nanosecond field from {@code LocalTime} is
 * not part of the newly created {@code Time} object.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}
 
源代码19 项目: jdk8u-dev-jdk   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}
 
源代码20 项目: JDKSourceCode1.8   文件: Time.java
/**
 * Obtains an instance of {@code Time} from a {@link LocalTime} object
 * with the same hour, minute and second time value as the given
 * {@code LocalTime}.
 *
 * @param time a {@code LocalTime} to convert
 * @return a {@code Time} object
 * @exception NullPointerException if {@code time} is null
 * @since 1.8
 */
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
    return new Time(time.getHour(), time.getMinute(), time.getSecond());
}