commit 3df4029f13d7c363d034d1c5aed186ba947ab8a6 from: Oliver Lowe date: Tue May 20 06:03:16 2025 UTC m3u8: unexport, use consistent timestamp layout The layout is meant to be used internally; the external interface is regular time.Time values. commit - a5e36fbfb60aadd58d7a06c29272251c0a8f8c0e commit + 3df4029f13d7c363d034d1c5aed186ba947ab8a6 blob - adc8fd2355da09c757965f96bbcdaa1c874030d5 blob + 42e7b755a242e367ee4becedb63bba89ecd28c46 --- m3u8/m3u8.go +++ m3u8/m3u8.go @@ -14,7 +14,7 @@ import ( const MimeType string = "application/vnd.apple.mpegurl" -const RFC3339Milli string = "2006-01-02T15:04:05.999Z07:00" +const rfc3339Milli string = "2006-01-02T15:04:05.999Z07:00" type Playlist struct { Version int blob - f20f8a3d8585da03597a22dc361b29eebb0727f2 blob + 0b9fdc9478e2542627b7c7f74521a3c2a8189985 --- m3u8/segment.go +++ m3u8/segment.go @@ -86,7 +86,7 @@ func parseSegment(items chan item, leading item) (*Seg seg.Map = &m case tagDateTime: it = <-segItems - t, err := time.Parse(time.RFC3339Nano, it.val) + t, err := time.Parse(rfc3339Milli, it.val) if err != nil { return nil, fmt.Errorf("bad date time tag: %w", err) } @@ -275,7 +275,7 @@ func (seg *Segment) MarshalText() ([]byte, error) { tags = append(tags, seg.Map.String()) } if !seg.DateTime.IsZero() { - tags = append(tags, fmt.Sprintf("%s:%s", tagDateTime, seg.DateTime.Format(RFC3339Milli))) + tags = append(tags, fmt.Sprintf("%s:%s", tagDateTime, seg.DateTime.Format(rfc3339Milli))) } us := seg.Duration / time.Microsecond // we do .03f for the same precision as test-streams.mux.dev. blob - 26ce401c6faba10a69cd1c0c0b8bcde3e70b5238 blob + 8965faf0b8183eb4c83ac5e280ed356c758f4233 --- m3u8/write.go +++ m3u8/write.go @@ -86,9 +86,9 @@ func writeDateRange(w io.Writer, dr *DateRange) error } var attrs []string attrs = append(attrs, fmt.Sprintf("ID=%q", dr.ID)) - attrs = append(attrs, fmt.Sprintf("START-DATE=%q", dr.Start.Format(time.RFC3339))) + attrs = append(attrs, fmt.Sprintf("START-DATE=%q", dr.Start.Format(rfc3339Milli))) if !dr.End.IsZero() { - attrs = append(attrs, fmt.Sprintf("END-DATE=%q", dr.End.Format(time.RFC3339))) + attrs = append(attrs, fmt.Sprintf("END-DATE=%q", dr.End.Format(rfc3339Milli))) } if dr.Class != "" { attrs = append(attrs, fmt.Sprintf("CLASS=%q", dr.Class))