mirror of https://bitbucket.org/ausocean/av.git
psi: HasTime rather than chkTime
This commit is contained in:
parent
ac11b281c5
commit
0b9f0f49fe
|
@ -45,7 +45,7 @@ func TimeBytes(t uint64) (s []byte) {
|
||||||
|
|
||||||
// ChkTime takes a psi as a byte slice and checks to see if it has a time descriptor
|
// ChkTime takes a psi as a byte slice and checks to see if it has a time descriptor
|
||||||
// - if so return nil, otherwise return error
|
// - if so return nil, otherwise return error
|
||||||
func ChkTime(p []byte) error {
|
func HasTime(p []byte) error {
|
||||||
if p[timeTagIndx] != timeDescTag {
|
if p[timeTagIndx] != timeDescTag {
|
||||||
return errors.New("PSI does not contain a time descriptor, cannot update")
|
return errors.New("PSI does not contain a time descriptor, cannot update")
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ func HasLocation(p []byte) error {
|
||||||
// as an integer and attempts to update the time descriptor in the pmt with the
|
// as an integer and attempts to update the time descriptor in the pmt with the
|
||||||
// given time if the time descriptor exists, otherwise an error is returned
|
// given time if the time descriptor exists, otherwise an error is returned
|
||||||
func UpdateTime(d []byte, t uint64) error {
|
func UpdateTime(d []byte, t uint64) error {
|
||||||
err := ChkTime(d)
|
err := HasTime(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ func UpdateTime(d []byte, t uint64) error {
|
||||||
// timestamp, returning as a uint64 if it exists, otherwise returning 0 and nil
|
// timestamp, returning as a uint64 if it exists, otherwise returning 0 and nil
|
||||||
// if it does not exist
|
// if it does not exist
|
||||||
func TimeFrom(p []byte) (t uint64, err error) {
|
func TimeFrom(p []byte) (t uint64, err error) {
|
||||||
err = ChkTime(p)
|
err = HasTime(p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue