Surfaced from a Qodo /agentic_review on the Python port of PR #167 (daqifi/daqifi-python-core PR #103).
Bug
`CsvExporter.FormatTimestamp` treats `ticks == 0` as invalid:
```csharp
if (ticks <= 0 || ticks > DateTime.MaxValue.Ticks)
return $"INVALID({ticks})";
```
But `new DateTime(0)` is `0001-01-01 00:00:00 UTC` (`DateTime.MinValue`), which is a legal value the formatter would otherwise handle correctly. The off-by-one renders `INVALID(0)` for what should be a real timestamp in both absolute and relative modes.
Fix (already shipped in Python port)
```csharp
if (ticks < 0 || ticks > DateTime.MaxValue.Ticks)
return $"INVALID({ticks})";
```
Refs
Surfaced from a Qodo /agentic_review on the Python port of PR #167 (daqifi/daqifi-python-core PR #103).
Bug
`CsvExporter.FormatTimestamp` treats `ticks == 0` as invalid:
```csharp
if (ticks <= 0 || ticks > DateTime.MaxValue.Ticks)
return $"INVALID({ticks})";
```
But `new DateTime(0)` is `0001-01-01 00:00:00 UTC` (`DateTime.MinValue`), which is a legal value the formatter would otherwise handle correctly. The off-by-one renders `INVALID(0)` for what should be a real timestamp in both absolute and relative modes.
Fix (already shipped in Python port)
```csharp
if (ticks < 0 || ticks > DateTime.MaxValue.Ticks)
return $"INVALID({ticks})";
```
Refs