Examples of TimeParser


Examples of org.jrobin.core.timespec.TimeParser

   *                        allowed see RRDTool's <code>rrdfetch</code> man page.<p>
   * @return timestamp in seconds since epoch.
   * @throws RrdException Thrown if invalid time specification is supplied.
   */
  public static long getTimestamp(final String atStyleTimeSpec) throws RrdException {
      final TimeSpec timeSpec = new TimeParser(atStyleTimeSpec).parse();
    return timeSpec.getTimestamp();
  }
View Full Code Here

Examples of org.jrobin.core.timespec.TimeParser

   *                         allowed see RRDTool's <code>rrdfetch</code> man page.<p>
   * @return An array of two longs representing starting and ending timestamp in seconds since epoch.
   * @throws RrdException Thrown if any input time specification is invalid.
   */
  public static long[] getTimestamps(final String atStyleTimeSpec1, final String atStyleTimeSpec2) throws RrdException {
      final TimeSpec timeSpec1 = new TimeParser(atStyleTimeSpec1).parse();
    final TimeSpec timeSpec2 = new TimeParser(atStyleTimeSpec2).parse();
    return TimeSpec.getTimestamps(timeSpec1, timeSpec2);
  }
View Full Code Here

Examples of org.jrobin.core.timespec.TimeParser

   *                        allowed see RRDTool's <code>rrdfetch</code> man page.<p>
   * @return timestamp in seconds since epoch.
   * @throws RrdException Thrown if invalid time specification is supplied.
   */
  public static long getTimestamp(String atStyleTimeSpec) throws RrdException {
    TimeSpec timeSpec = new TimeParser(atStyleTimeSpec).parse();
    return timeSpec.getTimestamp();
  }
View Full Code Here

Examples of org.jrobin.core.timespec.TimeParser

   *                         allowed see RRDTool's <code>rrdfetch</code> man page.<p>
   * @return An array of two longs representing starting and ending timestamp in seconds since epoch.
   * @throws RrdException Thrown if any input time specification is invalid.
   */
  public static long[] getTimestamps(String atStyleTimeSpec1, String atStyleTimeSpec2) throws RrdException {
    TimeSpec timeSpec1 = new TimeParser(atStyleTimeSpec1).parse();
    TimeSpec timeSpec2 = new TimeParser(atStyleTimeSpec2).parse();
    return TimeSpec.getTimestamps(timeSpec1, timeSpec2);
  }
View Full Code Here

Examples of org.jwall.log.io.TimeParser

 
  @Test
  public void testParseTime() throws Exception {
    String str = "1 hour";
    TimeParser p = new TimeParser();
    Long time = p.parse( str );
    Assert.assertEquals( TimeParser.HOUR, time );
  }
View Full Code Here

Examples of org.jwall.log.io.TimeParser

  }
 
  @Test
  public void testParseHourShortened() throws Exception {
    String str = "2 hours";
    TimeParser p = new TimeParser();
    Long time = p.parse( str );
    Assert.assertEquals( 2*TimeParser.HOUR, time.longValue() );
  }
View Full Code Here

Examples of org.jwall.log.io.TimeParser

  }
 
  @Test
  public void testParseMix() throws Exception {
    String str = "2 hours 34 minutes 1sec";
    TimeParser p = new TimeParser();
    Long time = p.parse( str );
    Assert.assertEquals( 2*TimeParser.HOUR + 34 * TimeParser.MINUTE + TimeParser.SECOND, time.longValue() );
  }
View Full Code Here

Examples of org.jwall.log.io.TimeParser

 
  @Test
  public void testParseMix2() throws Exception {
    String str = "2hours34minutes 1sec";
    TimeParser p = new TimeParser();
    Long time = p.parse( str );
    Assert.assertEquals( 2*TimeParser.HOUR + 34 * TimeParser.MINUTE + TimeParser.SECOND, time.longValue() );
  }
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.