Class Duration
- Namespace
- GenerativeAI.Types
- Assembly
- GenerativeAI.dll
A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution.
[JsonConverter(typeof(DurationJsonConverter))]
public class Duration
- Inheritance
-
Duration
- Inherited Members
- Extension Methods
Properties
Nanos
Signed fractions of a second at nanosecond resolution of the span of time. Durations less than one second are represented with a 0 Seconds field and a positive or negative Nanos field. For durations of one second or more, a non-zero value for the Nanos field must be of the same sign as the Seconds field. Must be from -999,999,999 to +999,999,999 inclusive.
public int Nanos { get; set; }
Property Value
Seconds
Signed seconds of the span of time. Must be from -315,576,000,000 to +315,576,000,000 inclusive.
public long Seconds { get; set; }
Property Value
Methods
FromTimeSpan(TimeSpan)
public static Duration FromTimeSpan(TimeSpan timeSpan)
Parameters
Returns
ToTimeSpan()
public TimeSpan ToTimeSpan()
Returns
Operators
implicit operator TimeSpan(Duration)
public static implicit operator TimeSpan(Duration duration)
Parameters
Returns
implicit operator Duration(TimeSpan)
public static implicit operator Duration(TimeSpan timeSpan)