* Separate from ion-sfu changes: 1. extract pkg/buffer, twcc, sfu, relay, stats, logger 2. to solve cycle import, move ion-sfu/pkg/logger to pkg/sfu/logger 3. replace pion/ion-sfu => ./ reason: will change import pion/ion-sfu/pkg/* to livekit-server/pkg/* after this pr merged. Just not change any code in this pr, because it will confused with the separate code from ion-sfu in review. * Move code from ion-sfu to pkg/sfu * fix build error for resovle conflict Co-authored-by: cnderrauber <zengjie9004@gmail.com>
35 lines
575 B
Go
35 lines
575 B
Go
package sfu
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func Test_timeToNtp(t *testing.T) {
|
|
type args struct {
|
|
ns time.Time
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
wantNTP uint64
|
|
}{
|
|
{
|
|
name: "Must return correct NTP time",
|
|
args: args{
|
|
ns: time.Unix(1602391458, 1234),
|
|
},
|
|
wantNTP: 16369753560730047668,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
tt := tt
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
gotNTP := uint64(toNtpTime(tt.args.ns))
|
|
if gotNTP != tt.wantNTP {
|
|
t.Errorf("timeToNtp() gotFraction = %v, want %v", gotNTP, tt.wantNTP)
|
|
}
|
|
})
|
|
}
|
|
}
|