Examples of inMillis()


Examples of com.google.code.tempusfugit.temporal.Duration.inMillis()

    private static final long MILLIS_IN_A_SECOND = SECONDS.toMillis(1);

    @Test
    public void convertSeconds() {
        Duration duration = seconds(60);
        assertThat(duration.inMillis(), is(60000L));
        assertThat(duration.inSeconds(), is(60L));
        assertThat(duration.inMinutes(), is(1L));
        assertThat(duration.inHours(), is(0L));
        assertThat(duration.inDays(), is(0L));
    }
View Full Code Here

Examples of com.google.code.tempusfugit.temporal.Duration.inMillis()

    }

    @Test
    public void convertSecondsRoundingResult() {
        Duration duration = seconds(95);
        assertThat(duration.inMillis(), is(95000L));
        assertThat(duration.inSeconds(), is(95L));
        assertThat(duration.inMinutes(), is(1L));
        assertThat(duration.inHours(), is(0L));
        assertThat(duration.inDays(), is(0L));
    }
View Full Code Here

Examples of com.google.code.tempusfugit.temporal.Duration.inMillis()

    }

    @Test
    public void convertMinutes() {
        Duration duration = minutes(50);
        assertThat(duration.inMillis(), is(3000000L));
        assertThat(duration.inSeconds(), is(3000L));
        assertThat(duration.inMinutes(), is(50L));
        assertThat(duration.inHours(), is(0L));
        assertThat(duration.inDays(), is(0L));
    }
View Full Code Here

Examples of com.google.code.tempusfugit.temporal.Duration.inMillis()

    }

    @Test
    public void conversionHours() {
        Duration duration = hours(24);
        assertThat(duration.inMillis(), is(86400000L));
        assertThat(duration.inSeconds(), is(86400L));
        assertThat(duration.inMinutes(), is(1440L));
        assertThat(duration.inHours(), is(24L));
        assertThat(duration.inDays(), is(1L));
    }
View Full Code Here

Examples of com.google.code.tempusfugit.temporal.Duration.inMillis()

        Duration duration = Duration.days(10L);
        assertThat(duration.inDays(), is(10L));
        assertThat(duration.inHours(), is(duration.inDays() * HOURS_IN_A_DAY));
        assertThat(duration.inMinutes(), is(duration.inHours() * MINUTES_IN_AN_HOUR));
        assertThat(duration.inSeconds(), is(duration.inMinutes() * SECONDS_IN_A_MINUTE));
        assertThat(duration.inMillis(), is(duration.inSeconds() * MILLIS_IN_A_SECOND));
    }

    @Test
    public void canAddDurations() {
        assertThat(days(1).plus(days(1)), is(equalTo(days(2))));
View Full Code Here

Examples of com.volantis.shared.time.Period.inMillis()

                headers.remove(oldHeader);
            }
        }
        // compute the current age
        final Period currentAge = state.getCurrentAge(clock.getCurrentTime());
        final long currentAgeLong = currentAge.inMillis() / 1000;
        final int currentAgeInt;
        if (currentAgeLong > Integer.MAX_VALUE) {
            currentAgeInt = Integer.MAX_VALUE;
        } else {
            currentAgeInt = (int) currentAgeLong;
View Full Code Here

Examples of com.volantis.shared.time.Period.inMillis()

            throw new IllegalArgumentException(
                    "Statistics not gathered from same source");
        }

        Period period = gatherTime.getPeriodSince(snapshot.gatherTime);
        if (period.inMillis() < 0) {
            throw new IllegalArgumentException("Other snapshot must have been " +
                    "gathered before this snapshot");
        }

        int deltaHitCount = getHitCount() - snapshot.getHitCount();
View Full Code Here

Examples of com.volantis.shared.time.Period.inMillis()

                // compute max-age value
                final Period timeToLive = cachingDirectives.getTimeToLive();
                long maxAgeInSeconds = 0;
                if (timeToLive != null) {
                    maxAgeInSeconds =
                        LongHelper.asInt(timeToLive.inMillis() / 1000);
                    if (maxAgeInSeconds < 0) {
                        maxAgeInSeconds = 0;
                    }
                }
                response.addHeader("Cache-Control", "max-age=" + maxAgeInSeconds);
View Full Code Here

Examples of com.volantis.shared.time.Period.inMillis()

            context.getEnvironmentContext().getCachingDirectives();
        long timeToLive = -1;
        if (cachingDirectives != null) {
            final Period ttl = cachingDirectives.getTimeToLive();
            if (ttl != null) {
                timeToLive = ttl.inMillis();
            }
        }

        // Create and store CSS Cache Entry.
        final CacheIdentity identity =
View Full Code Here

Examples of com.volantis.shared.time.Time.inMillis()

                    if (lastModified != null) {
                        final String lastModifiedAsString;
                        // SimpleDateFormat is not thread safe
                        synchronized (RFC1123) {
                            lastModifiedAsString = RFC1123.format(
                                new Date(lastModified.inMillis()));
                        }
                        final Header header =
                            new HeaderImpl(HeaderNames.IF_MODIFIED_SINCE_HEADER);
                        header.setValue(lastModifiedAsString);
                        executor.addRequestHeader(header);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.