in src/Elastic.Clients.Elasticsearch/_Shared/Core/DateTime/Duration.cs [158:189]
public int CompareTo(Duration other)
{
if (other == null)
return 1;
if (StaticTimeValue.HasValue && !other.StaticTimeValue.HasValue)
return -1;
if (!StaticTimeValue.HasValue && other.StaticTimeValue.HasValue)
return 1;
if (StaticTimeValue.HasValue && other.StaticTimeValue.HasValue)
{
if (StaticTimeValue.Value == other.StaticTimeValue.Value)
return 0;
if (StaticTimeValue.Value < other.StaticTimeValue.Value)
return -1;
return 1;
}
if (Milliseconds == null && other.Milliseconds == null)
return 0;
if (Milliseconds != null && other.Milliseconds == null)
return 1;
if (Milliseconds == null || other.Milliseconds == null)
return 1;
if (Math.Abs(Milliseconds.Value - other.Milliseconds.Value) < FLOAT_TOLERANCE)
return 0;
if (other.Milliseconds != null && Milliseconds < other.Milliseconds.Value)
return -1;
return 1;
}