Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "gs: drop tmms if invalid" #209

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions pkg/ttnpb/udp/translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ import (
)

const (
gpsTimeDelta = 5 * time.Second // for validating tmms/GPS time
delta = 0.001 // For GPS comparisons
lora = "LORA"
fsk = "FSK"
lrfhss = "LR-FHSS"
delta = 0.001 // For GPS comparisons
lora = "LORA"
fsk = "FSK"
lrfhss = "LR-FHSS"

// eirpDelta is the delta between EIRP and ERP.
eirpDelta = 2.15
Expand Down Expand Up @@ -202,15 +201,8 @@ func convertUplink(rx RxPacket, md UpstreamMetadata) (*ttnpb.UplinkMessage, erro
var goTime, goGpsTime time.Time
switch {
case rx.Tmms != nil:

ggt := gpstime.Parse(time.Duration(*rx.Tmms) * time.Millisecond)
currentUTC := time.Now().UTC()
diff := ggt.Sub(currentUTC).Abs().Seconds()
if diff < gpsTimeDelta.Seconds() {
goGpsTime = ggt
goTime = goGpsTime
}

goGpsTime = gpstime.Parse(time.Duration(*rx.Tmms) * time.Millisecond)
goTime = goGpsTime
case rx.Time != nil:
goTime = time.Time(*rx.Time)
}
Expand Down
Loading