psi: d to dst in updateTime

This commit is contained in:
saxon 2018-12-14 16:21:56 +10:30
parent d961cf172d
commit 404a2b6c99
1 changed files with 5 additions and 5 deletions

View File

@ -64,16 +64,16 @@ func HasLocation(p []byte) error {
// UpdateTime takes the byte slice representation of a psi-pmt as well as a time // UpdateTime takes the byte slice representation of a psi-pmt as well as a time
// 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(dst []byte, t uint64) error {
err := HasTime(d) err := HasTime(dst)
if err != nil { if err != nil {
return err return err
} }
ts := TimeBytes(uint64(t)) ts := TimeBytes(uint64(t))
for i := range d[timeDataIndx : timeDataIndx+timeDataSize] { for i := range dst[timeDataIndx : timeDataIndx+timeDataSize] {
d[i+timeDataIndx] = ts[i] dst[i+timeDataIndx] = ts[i]
} }
d = updateCrc(d) dst = updateCrc(dst)
return nil return nil
} }