Java Code Examples for java.time.temporal.ChronoUnit#MILLIS
The following examples show how to use
java.time.temporal.ChronoUnit#MILLIS .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Temporals.java From grakn with GNU Affero General Public License v3.0 | 6 votes |
public static ChronoUnit chronoUnit(TimeUnit unit) { switch (unit) { case NANOSECONDS: return ChronoUnit.NANOS; case MICROSECONDS: return ChronoUnit.MICROS; case MILLISECONDS: return ChronoUnit.MILLIS; case SECONDS: return ChronoUnit.SECONDS; case MINUTES: return ChronoUnit.MINUTES; case HOURS: return ChronoUnit.HOURS; case DAYS: return ChronoUnit.DAYS; default: throw new IllegalArgumentException("Cannot convert timeunit"); } }
Example 2
Source File: XmlModel.java From ehcache3 with Apache License 2.0 | 6 votes |
public static TemporalUnit convertToJavaTimeUnit(org.ehcache.xml.model.TimeUnit unit) { switch (unit) { case NANOS: return ChronoUnit.NANOS; case MICROS: return ChronoUnit.MICROS; case MILLIS: return ChronoUnit.MILLIS; case SECONDS: return ChronoUnit.SECONDS; case MINUTES: return ChronoUnit.MINUTES; case HOURS: return ChronoUnit.HOURS; case DAYS: return ChronoUnit.DAYS; default: throw new IllegalArgumentException("Unknown time unit: " + unit); } }
Example 3
Source File: Timeouts.java From tascalate-concurrent with Apache License 2.0 | 6 votes |
private static ChronoUnit toChronoUnit(TimeUnit unit) { Objects.requireNonNull(unit, "unit"); switch (unit) { case NANOSECONDS: return ChronoUnit.NANOS; case MICROSECONDS: return ChronoUnit.MICROS; case MILLISECONDS: return ChronoUnit.MILLIS; case SECONDS: return ChronoUnit.SECONDS; case MINUTES: return ChronoUnit.MINUTES; case HOURS: return ChronoUnit.HOURS; case DAYS: return ChronoUnit.DAYS; default: throw new IllegalArgumentException("Unknown TimeUnit constant"); } }
Example 4
Source File: ExpiryUtils.java From ehcache3 with Apache License 2.0 | 6 votes |
public static TemporalUnit jucTimeUnitToTemporalUnit(TimeUnit timeUnit) { switch (timeUnit) { case NANOSECONDS: return ChronoUnit.NANOS; case MICROSECONDS: return ChronoUnit.MICROS; case MILLISECONDS: return ChronoUnit.MILLIS; case SECONDS: return ChronoUnit.SECONDS; case MINUTES: return ChronoUnit.MINUTES; case HOURS: return ChronoUnit.HOURS; case DAYS: return ChronoUnit.DAYS; default: throw new AssertionError("Unkown TimeUnit: " + timeUnit); } }
Example 5
Source File: TCKPeriod.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="BadTemporalUnit") Object[][] data_badTemporalUnit() { return new Object[][] { {ChronoUnit.MICROS}, {ChronoUnit.MILLIS}, {ChronoUnit.HALF_DAYS}, {ChronoUnit.DECADES}, {ChronoUnit.CENTURIES}, {ChronoUnit.MILLENNIA}, }; }
Example 6
Source File: Bulkhead55RapidRetry10MethodSynchBean.java From microprofile-fault-tolerance with Apache License 2.0 | 5 votes |
@Override @Bulkhead(waitingTaskQueue = 5, value = 5) @Retry(delay = 1, delayUnit = ChronoUnit.MILLIS, maxRetries = 10, maxDuration=999999) public Future test(BackendTestDelegate action) throws InterruptedException { Utils.log("in business method of bean " + this.getClass().getName()); return action.perform(); }
Example 7
Source File: TCKPeriod.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="BadTemporalUnit") Object[][] data_badTemporalUnit() { return new Object[][] { {ChronoUnit.MICROS}, {ChronoUnit.MILLIS}, {ChronoUnit.HALF_DAYS}, {ChronoUnit.DECADES}, {ChronoUnit.CENTURIES}, {ChronoUnit.MILLENNIA}, }; }
Example 8
Source File: PropertiesUtil.java From logging-log4j2 with Apache License 2.0 | 5 votes |
static Duration getDuration(String time) { String value = time.trim(); TemporalUnit temporalUnit = ChronoUnit.MILLIS; long timeVal = 0; for (TimeUnit timeUnit : values()) { for (String suffix : timeUnit.descriptions) { if (value.endsWith(suffix)) { temporalUnit = timeUnit.timeUnit; timeVal = Long.parseLong(value.substring(0, value.length() - suffix.length())); } } } return Duration.of(timeVal, temporalUnit); }
Example 9
Source File: TCKPeriod.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="BadTemporalUnit") Object[][] data_badTemporalUnit() { return new Object[][] { {ChronoUnit.MICROS}, {ChronoUnit.MILLIS}, {ChronoUnit.HALF_DAYS}, {ChronoUnit.DECADES}, {ChronoUnit.CENTURIES}, {ChronoUnit.MILLENNIA}, }; }
Example 10
Source File: TCKPeriod.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="BadTemporalUnit") Object[][] data_badTemporalUnit() { return new Object[][] { {ChronoUnit.MICROS}, {ChronoUnit.MILLIS}, {ChronoUnit.HALF_DAYS}, {ChronoUnit.DECADES}, {ChronoUnit.CENTURIES}, {ChronoUnit.MILLENNIA}, }; }
Example 11
Source File: PyramidPlunderTimer.java From plugins with GNU General Public License v3.0 | 5 votes |
public PyramidPlunderTimer( Duration duration, BufferedImage image, PyramidPlunderPlugin plugin, PyramidPlunderConfig config, Client client ) { super(duration.toMillis(), ChronoUnit.MILLIS, image, plugin); this.config = config; this.client = client; }
Example 12
Source File: DateWrapper.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
public DateWrapper(final int year, final Month month, final int dayOfMonth, final int hour, final int minute, final int second, final int millis) { wrapped = ZonedDateTime .of( LocalDateTime.of(year, month, dayOfMonth, hour, minute, second, millis * 1000000), ZoneId.systemDefault()) .toInstant(); accuracy = ChronoUnit.MILLIS; }
Example 13
Source File: Service.java From quarkus with Apache License 2.0 | 5 votes |
@Asynchronous @Fallback(fallbackMethod = "fallback") @Timeout(value = 20L, unit = ChronoUnit.MILLIS) @Retry(delay = 10L, maxRetries = 2) public CompletionStage<String> faultTolerance() { tracer.buildSpan("ft").start().finish(); throw new RuntimeException(); }
Example 14
Source File: CustomExtension.java From smallrye-fault-tolerance with Apache License 2.0 | 4 votes |
@Override public ChronoUnit jitterDelayUnit() { return ChronoUnit.MILLIS; }
Example 15
Source File: RespawnTimer.java From plugins with GNU General Public License v3.0 | 4 votes |
RespawnTimer(Boss boss, BufferedImage bossImage, Plugin plugin) { super(boss.getSpawnTime().toMillis(), ChronoUnit.MILLIS, bossImage, plugin); this.boss = boss; }
Example 16
Source File: TimeoutConfigBean.java From microprofile-fault-tolerance with Apache License 2.0 | 4 votes |
@Timeout(value = 1, unit = ChronoUnit.MILLIS) public void serviceValue() throws InterruptedException { Thread.sleep(TimeUnit.MINUTES.toMillis(1)); }
Example 17
Source File: TimerTimer.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
TimerTimer(GameTimer timer, Duration duration, Plugin plugin) { super(duration.toMillis(), ChronoUnit.MILLIS, null, plugin); this.timer = timer; setPriority(InfoBoxPriority.MED); }
Example 18
Source File: AggressionTimer.java From plugins with GNU General Public License v3.0 | 4 votes |
AggressionTimer(final Duration duration, final BufferedImage image, final Plugin plugin, final boolean visible) { super(duration.toMillis(), ChronoUnit.MILLIS, image, plugin); setTooltip("Time until NPCs become unaggressive"); this.visible = visible; }
Example 19
Source File: TimePeriodSpec.java From java-timeseries with MIT License | 4 votes |
@Test public final void whenMillisecondsTotalComputedResultCorrect() { TimePeriod millis = new TimePeriod(ChronoUnit.MILLIS, 480); assertThat(millis.totalSeconds(), is(equalTo(0.48))); }
Example 20
Source File: TimeIntervalTest.java From influxdb-client-java with MIT License | 3 votes |
@Test void millis() { TimeInterval interval = new TimeInterval(3L, ChronoUnit.MILLIS); Assertions.assertThat(interval.toString()).isEqualTo("3ms"); }