Go to the documentation of this file.
19package org.sleuthkit.autopsy.timeline.utils;
21import java.time.Instant;
22import java.time.temporal.TemporalAmount;
23import java.util.Collection;
24import org.joda.time.DateTime;
25import org.joda.time.DateTimeZone;
26import org.joda.time.Interval;
27import org.joda.time.ReadablePeriod;
28import org.sleuthkit.autopsy.timeline.zooming.TimeUnits;
39 Interval trange =
null;
40 for (DateTime t : times) {
42 trange =
new Interval(t.getMillis(), t.getMillis() + 1000, DateTimeZone.UTC);
50 static public Interval
span(Interval range,
final Interval range2) {
51 return new Interval(Math.min(range.getStartMillis(), range2.getStartMillis()), Math.max(range.getEndMillis(), range2.getEndMillis()), DateTimeZone.UTC);
54 static public Interval
extendInterval(Interval range,
final Long eventTime) {
55 return new Interval(Math.min(range.getStartMillis(), eventTime), Math.max(range.getEndMillis(), eventTime + 1), DateTimeZone.UTC);
58 public static DateTime
middleOf(Interval interval) {
59 return new DateTime((interval.getStartMillis() + interval.getEndMillis()) / 2);
67 DateTime start = aroundInstant.minus(period);
68 DateTime end = aroundInstant.plus(period);
69 Interval range =
new Interval(start, end);
71 long halfRange = range.toDurationMillis() / 4;
75 static public Interval
getIntervalAround(Instant aroundInstant, TemporalAmount temporalAmount) {
76 long start = aroundInstant.minus(temporalAmount).toEpochMilli();
77 long end = aroundInstant.plusMillis(1).plus(temporalAmount).toEpochMilli();
78 return new Interval(start, Math.max(start + 1, end));
static Interval getIntervalAround(DateTime aroundInstant, ReadablePeriod period)
static Interval extendInterval(Interval range, final Long eventTime)
static Interval span(Interval range, final Interval range2)
static DateTime middleOf(Interval interval)
static Interval getSpanningInterval(Collection< DateTime > times)
static Interval getIntervalAround(Instant aroundInstant, TemporalAmount temporalAmount)
static Interval getIntervalAroundMiddle(Interval interval, ReadablePeriod period)
static Interval getAdjustedInterval(Interval oldInterval, TimeUnits requestedUnit)
Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a
Creative Commons Attribution-Share Alike 3.0 United States License.