com.bigdata.counters.query
Class TimeRange
java.lang.Object
com.bigdata.counters.query.TimeRange
public class TimeRange
- extends Object
Utility class to interpret URL query parameters as a time range. Some
examples of supported expressions include:
- 12m
- 12 minutes into the available history.
- -4h
- 4 hours before the end of the available history.
The general form is either ([+-]?)([0-9]+)([mhd]).
The implied fromTime is the start of the available history. The implied
toTime is the end of the available history. The implied units are
TimeUnit.MINUTES.
Some query examples are:
- fromTime=-10m&period=Minutes
- The last 10 minutes of the available history.
- toTime=+4h
- The first 4 hours of the available history, with one sample every
minute.
- toTime=+4h&period=Hours
- The first 4 hours of the available history, with one sample every hour.
- fromTime=+2h&toTime=+4h
- The data from the 2nd hour up to (but not including) the 4th hour of the
available history, with one sample every minute.
- Version:
- $Id: TimeRange.java 2265 2009-10-26 12:51:06Z thompsonbry $
- Author:
- Bryan Thompson
- TODO:
- fence posts all over for toTime, which needs to be correctly adjusted
to reveal the end of the last minute of interest by placing the toTime
to the first millisecond beyond the end of that minute., if no suffix then directly gives the milliseconds since the epoch?, the
XHTMLRenderer.URLQueryModel should also support fromDate and
toDate, where the values are dates/date-times and where there is an
optional URL query parameter to specify the format string used to
interpret the data/time.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
relative
public final Boolean relative
- TODO:
true iff the adjusted time is dur units
after some (unspecified) reference time; false iff the
adjusted time is dur units before some (unspecified)
reference time; and null if dur should be
directly interpreted as a time in the specified units.
unit
public final TimeUnit unit
- The units in which the duration was specified.
dur
public final long dur
- The duration in the specified units.
pattern
protected static final Pattern pattern
TimeRange
public TimeRange(String s)
getAdjustedTimestamp
public long getAdjustedTimestamp(long ts)
- Parameters:
ts - A reference timestamp from within the available history.
- Returns:
- The exclusive upper bound.
- TODO:
- Return the adjusted timestamp. This is
dur unless
relative is true in which case it is the given
timestamp minus dur.
Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.