@@ -3,7 +3,6 @@ package structs
3
3
import (
4
4
"encoding/binary"
5
5
"math"
6
- "os"
7
6
"time"
8
7
9
8
"github.com/brocaar/chirpstack-api/go/v3/common"
@@ -76,6 +75,17 @@ func SetRadioMetaDataToProto(loraBand band.Band, gatewayID lorawan.EUI64, rmd Ra
76
75
CrcStatus : gw .CRCStatus_CRC_OK ,
77
76
}
78
77
78
+ if rxTime := rmd .UpInfo .RxTime ; rxTime != 0 {
79
+ sec , nsec := math .Modf (rmd .UpInfo .RxTime )
80
+ if sec != 0 {
81
+ val := time .Unix (int64 (sec ), int64 (nsec ))
82
+ pb .RxInfo .Time , err = ptypes .TimestampProto (val )
83
+ if err != nil {
84
+ return errors .Wrap (err , "rxtime/timestamp proto error" )
85
+ }
86
+ }
87
+ }
88
+
79
89
if gpsTime := rmd .UpInfo .GPSTime ; gpsTime != 0 {
80
90
gpsTimeDur := time .Duration (gpsTime ) * time .Microsecond
81
91
gpsTimeTime := time .Time (gps .NewTimeFromTimeSinceGPSEpoch (gpsTimeDur ))
@@ -88,19 +98,6 @@ func SetRadioMetaDataToProto(loraBand band.Band, gatewayID lorawan.EUI64, rmd Ra
88
98
89
99
}
90
100
91
- // The WORKAROUND_IGNORE_RX_TIME flag is a workaround in case the reported
92
- // rxtime from the Basics Station must be ignored (e.g. it is not accurate).
93
- if rxTime := rmd .UpInfo .RxTime ; rxTime != 0 && os .Getenv ("WORKAROUND_IGNORE_RX_TIME" ) == "" {
94
- sec , nsec := math .Modf (rmd .UpInfo .RxTime )
95
- if sec != 0 {
96
- val := time .Unix (int64 (sec ), int64 (nsec ))
97
- pb .RxInfo .Time , err = ptypes .TimestampProto (val )
98
- if err != nil {
99
- return errors .Wrap (err , "rxtime/timestamp proto error" )
100
- }
101
- }
102
- }
103
-
104
101
// Context
105
102
pb .RxInfo .Context = make ([]byte , 16 )
106
103
binary .BigEndian .PutUint64 (pb .RxInfo .Context [0 :8 ], uint64 (rmd .UpInfo .RCtx ))
0 commit comments