Package: groovy.time

## [Java] Record Timed

- groovy.time.Timed

-     public record Timed
      extends Record

  An immutable holder for the outcome of a timed execution: the value produced together with the elapsed time in nanoseconds. Instances are created by the `timed` extension method rather than being constructed directly.

  The elapsed time is measured with System.nanoTime, which is monotonic and unaffected by wall-clock adjustments. Convenience views of the duration are available via getDuration() and getMillis(), which Groovy exposes as the `duration` and `millis` properties.

       def t = System.timed { (1..1_000).sum() }
       assert t.result == 500_500
       assert t.nanos >= 0
       assert t.duration instanceof java.time.Duration

  Type Parameters:
    `T` - the type of the timed result
  Parameters:
    `result` - the value returned by the timed code
    `nanos` - the elapsed time in nanoseconds, as measured by System.nanoTime
  Since:
    6.0.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Duration` | `getDuration()` Returns the elapsed time as a Duration.
    `` | `public long` | `getMillis()` Returns the elapsed time in whole milliseconds, truncated toward zero.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Record` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### public Duration getDuration()

      Returns the elapsed time as a Duration. Exposed to Groovy as the read-only `duration` property.

      Returns:
        the elapsed time as a `Duration`
      Since:
        6.0.0

    - #### public long getMillis()

      Returns the elapsed time in whole milliseconds, truncated toward zero. Exposed to Groovy as the read-only `millis` property.

      Returns:
        the elapsed time in milliseconds
      Since:
        6.0.0