Skip to content

Commit

Permalink
Get PostgreSQL rxTime from RxInfo if available.
Browse files Browse the repository at this point in the history
  • Loading branch information
brocaar committed Aug 23, 2021
1 parent f6b052a commit 413ebd6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions internal/integration/postgresql/postgresql.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,18 @@ func (i *Integration) HandleJoinEvent(ctx context.Context, _ models.Integration,
return errors.Wrap(err, "new uuid error")
}

// TODO: refactor to use gateway provided time once RXInfo is available
// and timestamp is provided by gateway.
// get the rxTime either using the system-time or using one of the
// gateway provided timestamps.
rxTime := time.Now()
for _, rxInfo := range pl.RxInfo {
if rxInfo.Time != nil {
ts, err := ptypes.Timestamp(rxInfo.Time)
if err != nil {
return errors.Wrap(err, "protobuf timestamp error")
}
rxTime = ts
}
}

var devEUI lorawan.EUI64
var devAddr lorawan.DevAddr
Expand Down

0 comments on commit 413ebd6

Please sign in to comment.