1
1
package rtcm3_test
2
2
3
3
import (
4
- "github.com/go-gnss/rtcm/rtcm3"
5
4
"testing"
6
5
"time"
6
+
7
+ "github.com/go-gnss/rtcm"
8
+ "github.com/go-gnss/rtcm/rtcm3"
7
9
)
8
10
9
11
func TestDF034 (t * testing.T ) {
@@ -18,6 +20,24 @@ func TestDF034(t *testing.T) {
18
20
}
19
21
}
20
22
23
+ func TestDF004 (t * testing.T ) {
24
+ utcInitialDate := time .Date (2021 , 12 , 12 , 0 , 0 , 0 , 0 , time .UTC )
25
+ utcDate := utcInitialDate
26
+ end := 60 * 60 * 24 * 8 // week + 1 day
27
+ for i := 0 ; i <= end ; i ++ {
28
+ utcDate = utcInitialDate .Add (time .Duration (i ) * time .Second )
29
+
30
+ gpsDate := utcDate .Add (rtcm .GpsLeapSeconds ())
31
+ sow := gpsDate .Truncate (time .Hour * 24 ).AddDate (0 , 0 , - int (gpsDate .Weekday ()))
32
+ e := uint32 (gpsDate .Sub (sow ).Milliseconds ())
33
+
34
+ latency := utcDate .Sub (rtcm3 .DF004Time (e , utcDate )).Milliseconds ()
35
+ if latency != 0 {
36
+ t .Errorf ("DF004 time incorrect. Expected %v, got %v (%vms difference)" , utcDate , rtcm3 .DF004Time (e , utcDate ), latency )
37
+ }
38
+ }
39
+ }
40
+
21
41
func TestDF386 (t * testing.T ) {
22
42
beforeUtcZero := time .Date (2019 , 2 , 7 , 23 , 41 , 40 , 0 , time .UTC )
23
43
if beforeUtcZero != rtcm3 .DF386 (9700 , beforeUtcZero ) {
0 commit comments