commit b9fff5d7c191955ae61eb22983fdd23993d995f0
parent f2462ddb1dad2764d71341d7cc259938f633d5d6
Author: Oliver Lowe <o@olowe.co>
Date: Tue, 16 Jul 2024 13:11:15 +1000
sdp: document Session.Time field
Need this especially as an undocumented [2] array is a magic number.
Diffstat:
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/sdp/parser.go b/sdp/parser.go
@@ -200,7 +200,8 @@ func (p *parser) parseMedia() error {
return p.err
}
-// number of seconds since the zero time used in SDP 1900-01-01T00:00Z.
+// number of seconds from the zero time used in SDP; 1900-01-01T00:00Z
+// to the Unix epoch.
const sinceTimeZero = 2208988800
func parseTimes(s string) ([2]time.Time, error) {
diff --git a/sdp/sdp.go b/sdp/sdp.go
@@ -24,6 +24,8 @@ type Session struct {
Phone string
Connection *ConnInfo
Bandwidth *Bandwidth
+ // Time holds the start time and stop time of the Session, at
+ // the first and second index respectively.
Time [2]time.Time
Repeat *Repeat
Attributes []string
@@ -81,8 +83,7 @@ func parseOrigin(line string) (Origin, error) {
// parseEmail returns the parsed email address from s.
// Addresses should be in RFC 5322 form, for instance
// "Oliver Lowe <o@olowe.co>" or just "o@olowe.co".
-// They can also be in the form detailed in the SDP specification,
-// for instance
+// They can also be in the form detailed in the SDP specification, for instance
// "Oliver Lowe (o@olowe.co)".
func parseEmail(s string) (*mail.Address, error) {
// Oliver Lowe (o@olowe.co) to RFC 5322 format