fix: address code review issues in indicators and core components

This commit is contained in:
Miha Kralj
2025-12-09 16:00:04 -05:00
parent 5e6e3a070e
commit c802a9ea80
12 changed files with 54 additions and 26 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ public readonly struct TValue : IEquatable<TValue>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public TValue(DateTime time, double value)
{
Time = time.Ticks;
Time = time.Kind == DateTimeKind.Utc ? time.Ticks : time.ToUniversalTime().Ticks;
Value = value;
}
@@ -38,7 +38,7 @@ public readonly struct TValue : IEquatable<TValue>
public override string ToString() => $"[{AsDateTime:yyyy-MM-dd HH:mm:ss}, {Value:F2}]";
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public bool Equals(TValue other) => Time == other.Time && Math.Abs(Value - other.Value) < 1e-9;
public bool Equals(TValue other) => Time == other.Time && Value == other.Value;
public override bool Equals(object? obj) => obj is TValue other && Equals(other);
public override int GetHashCode() => HashCode.Combine(Time, Value);