mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
23 lines
354 B
Go
23 lines
354 B
Go
|
package rtpconn
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestJSTime(t *testing.T) {
|
||
|
tm := time.Now()
|
||
|
js := toJSTime(tm)
|
||
|
tm2 := fromJSTime(js)
|
||
|
js2 := toJSTime(tm2)
|
||
|
|
||
|
if js != js2 {
|
||
|
t.Errorf("%v != %v", js, js2)
|
||
|
}
|
||
|
|
||
|
delta := tm.Sub(tm2)
|
||
|
if delta < -time.Millisecond/2 || delta > time.Millisecond/2 {
|
||
|
t.Errorf("Delta %v, %v, %v", delta, tm, tm2)
|
||
|
}
|
||
|
}
|