container/mts/psi/helpers.go: removed TimeFrom and usage in psi_test.go

This commit is contained in:
Saxon 2020-05-06 22:39:46 +09:30
parent a02dcd1856
commit fb04d23822
2 changed files with 0 additions and 22 deletions

View File

@ -75,17 +75,6 @@ func SyntaxSecLenFrom(p []byte) int {
return int(((p[SyntaxSecLenIdx1] & SyntaxSecLenMask1) << 8) | p[SyntaxSecLenIdx2]) return int(((p[SyntaxSecLenIdx1] & SyntaxSecLenMask1) << 8) | p[SyntaxSecLenIdx2])
} }
// TimeFrom takes a byte slice representation of a psi-pmt and extracts it's
// timestamp, returning as a uint64 if it exists, otherwise returning 0 and nil
// if it does not exist
func TimeFrom(p []byte) (t uint64, err error) {
if !HasTime(p) {
return 0, errors.New("pmt does not have a time descriptor")
}
t = binary.BigEndian.Uint64(p[TimeDataIndx : TimeDataIndx+TimeDataSize])
return t, nil
}
// LocationFrom takes a byte slice representation of a psi-pmt and extracts it's // LocationFrom takes a byte slice representation of a psi-pmt and extracts it's
// 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

View File

@ -313,17 +313,6 @@ func TestTimeUpdate(t *testing.T) {
} }
} }
// TestTimeGet tsts to see if we can correctly get the timestamp from a pmt
func TestTimeGet(t *testing.T) {
s, err := TimeFrom(pmtTimeBytes1)
if err != nil {
t.Errorf("Getting timestamp failed with err: %v", err)
}
if s != tstTime1 {
t.Errorf(errCmp, "TestTimeGet", tstTime1, s)
}
}
// TestLocationGet checks that we can correctly get location data from a pmt table // TestLocationGet checks that we can correctly get location data from a pmt table
func TestLocationGet(t *testing.T) { func TestLocationGet(t *testing.T) {
pb := standardPmtWithMeta.Bytes() pb := standardPmtWithMeta.Bytes()