diff options
| author | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-05-27 10:55:57 -0700 |
|---|---|---|
| committer | Jeff Halter <868228+jhalter@users.noreply.github.com> | 2022-05-27 10:55:57 -0700 |
| commit | 3c9b1dcdf40474396a3b035d548417b84a123164 (patch) | |
| tree | 08efd3a26e0bfe69c083c664ba4fd1eef0641358 /hotline/news.go | |
| parent | 61c272e101b6f0444c7b2a666b0b5e828ba6db03 (diff) | |
Simplify news article timestamping
Diffstat (limited to 'hotline/news.go')
| -rw-r--r-- | hotline/news.go | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/hotline/news.go b/hotline/news.go index 7a5c30c..a6b8372 100644 --- a/hotline/news.go +++ b/hotline/news.go @@ -5,7 +5,6 @@ import ( "crypto/rand" "encoding/binary" "sort" - "time" ) type ThreadedNews struct { @@ -250,25 +249,3 @@ func (s *Server) GetNewsCatByPath(paths []string) map[string]NewsCategoryListDat } return cats } - -// News article date field contains this structure: -// Year 2 -// Milliseconds 2 (seriously?) -// Seconds 4 -func NewsDate() []byte { - t := time.Now() - ms := []byte{0, 0} - seconds := []byte{0, 0, 0, 0} - - year := []byte{0, 0} - binary.BigEndian.PutUint16(year, uint16(t.Year())) - - yearStart := time.Date(t.Year(), time.January, 1, 0, 0, 0, 0, time.Local) - - binary.BigEndian.PutUint32(seconds, uint32(t.Sub(yearStart).Seconds())) - - date := append(year, ms...) - date = append(date, seconds...) - - return date -} |