org.apache.nutch.util

## Class TimingUtil

- java.lang.Object
- - org.apache.nutch.util.TimingUtil

-     public class TimingUtil
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.time.format.DateTimeFormatter` | `logDateFormat` Formats dates for logging

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TimingUtil()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `elapsedTime(long start, long end)` Calculate the elapsed time between two times specified in milliseconds.
    `static java.lang.String` | `logDateMillis(long millis)` Convert epoch milliseconds (`System.currentTimeMillis()`) into date string (local time zone) used for logging
    `static java.lang.String` | `secondsToDaysHMS(long seconds)` Show time in seconds as days, hours, minutes and seconds (d days, hh:mm:ss)
    `static java.lang.String` | `secondsToHMS(long seconds)` Show time in seconds as hours, minutes and seconds (hh:mm:ss)

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logDateFormat

          public static java.time.format.DateTimeFormatter logDateFormat

      Formats dates for logging

  - ### Constructor Detail

    - #### TimingUtil

          public TimingUtil()

  - ### Method Detail

    - #### logDateMillis

          public static java.lang.String logDateMillis(long millis)

      Convert epoch milliseconds (`System.currentTimeMillis()`) into date string (local time zone) used for logging

    - #### elapsedTime

          public static java.lang.String elapsedTime(long start,
                                                     long end)

      Calculate the elapsed time between two times specified in milliseconds.
      Parameters:
        `start` - The start of the time period
        `end` - The end of the time period
      Returns:
        a string of the form "XhYmZs" when the elapsed time is X hours, Y minutes and Z seconds or null if start > end.

    - #### secondsToHMS

          public static java.lang.String secondsToHMS(long seconds)

      Show time in seconds as hours, minutes and seconds (hh:mm:ss)
      Parameters:
        `seconds` - (elapsed) time in seconds
      Returns:
        human readable time string "hh:mm:ss"

    - #### secondsToDaysHMS

          public static java.lang.String secondsToDaysHMS(long seconds)

      Show time in seconds as days, hours, minutes and seconds (d days, hh:mm:ss)
      Parameters:
        `seconds` - (elapsed) time in seconds
      Returns:
        human readable time string "d days, hh:mm:ss"

Copyright © 2019 The Apache Software Foundation