diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-08-23 12:44:53 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2026-08-23 12:44:53 -0700 |
| commit | 68f615cc6e6ac177109db5b3be4f9767c9cfd1a8 (patch) | |
| tree | 37380267c1356e67783e9273495bfa099048486c /hotline/time_test.go | |
| parent | 4df6b97311e321c1ef178efce905307b10ce6fa7 (diff) | |
Add feed-backed threaded news imports
Diffstat (limited to 'hotline/time_test.go')
| -rw-r--r-- | hotline/time_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hotline/time_test.go b/hotline/time_test.go index b52f3ef..f9ee5c4 100644 --- a/hotline/time_test.go +++ b/hotline/time_test.go @@ -47,3 +47,16 @@ func TestNewTime_SecondsSinceMacEpoch(t *testing.T) { t.Errorf("Mac-epoch decode = %v, want %v", decoded, tm) } } + +func TestNewNewsTime_UsesSecondsSinceStartOfYear(t *testing.T) { + want := time.Date(2026, time.August, 22, 18, 9, 55, 0, time.Local) + + encoded := NewNewsTime(want) + seconds := binary.BigEndian.Uint32(encoded[4:8]) + if seconds >= 366*24*60*60 { + t.Fatalf("news seconds field = %d, want a year-relative value", seconds) + } + if got := encoded.NewsTime(); !got.Equal(want) { + t.Errorf("news time round trip = %v, want %v", got, want) + } +} |