Partially. Check my answer above your message. Gateway time is just a wall time, could be GPS based. Could be NTP based, could be manually entered and totally wrong.
Yes, so it will be reliable only, if one has control over the gateway.
But at least it can be probed against current TTN servertime (which i assume as being reliable) in the same dataset, to estimate if it is a valid, recent, gateway time.
I tried to find the logic how the gateway list is sorted in the repo, but no chance without knowledge of the code structure. Can you point me?
As far as I know the order is that in which packets arrive at the back-end. However I never felt the need to check the code. You can take a look at the Go sources for V2 of the back-end at GitHub.
if you see things that are not in signal strength order, it can’t be that…
if you see things that are not in gateway wall-clock order, it can’t be that…
Granted, you could see a pattern in a limited data set which turns out not to be true overall. But at the same time, it would be fair to ask “why do you care?”.
If it matters to you, and it is not explicitly clear in the specifications then you should probably sort the list yourself, to avoid any assumptions on behavior outside the specification on which it would be unsafe to rely, as it’s fair for unspecified behavior to change in a new version.
Incidentally, if a gateway based on a typical Linux has had a loss of Internet backhaul, and especially rebooted while under such loss, it is entirely possible when it gets back online for some packets to be reported with absurdly wrong wall clock times before the system gets an NTP fix and starts using accurate ones, unless it has specific logic to prevent that. Given that GPS can take time to lock, I could image a similar issue on a sufficiently cold start there as well.
If you’re trying to make the nodes transmit at the same time: don’t. That will create network issues. Instead, the node should always apply some randomness when it wants to transmit something.
If you’re trying to make the nodes know the current time, then remember that a downlink is always RX1 or RX2 seconds after the uplink, which can be used to synchronize clocks with a time you create yourself, rather than relying on some timestamp generated by some network server. But beware that a downlink that is scheduled after some uplink might not be transmitted right away, so might be transmitted after the next uplink, which you need to detect by including some counter. For all this, see Time synchronisation of a Node.
We had some issues with buffering gateways, so this is what we found:
Usually you can evaluate at least 3 different times from a message:
metadata.gateways[0].time: This is the time, the message was received on the gateway
metadata.time: This is the time, the message was send to the backend
The current time when the message is received by the final application
Most of the time the differences on our applications are below 300 ms, mainly caused by the transfer time between gateway and internet, but we have seen delays up to 10 s when the backend was very busy.
So, given all devices are synchronized to an ntp, the gateway[].time is most accurate. Specially if the gateways does some buffering and retransfer (like the Kerlink CPF), it may be the only usefull time.
On some gateways it may happen, that the time stamp is zero (Nil) for some unknown reason. Then it may be useful to use the other times as a fallback.
Hi. I understand your point of view. Nevertheless, I don’t know how to set the right UTC region in order to manage that information coming in the payload. I am using a Pygate Gateway setting to AU915 but I am in Brazil. I am showing the date in to the payload on Node-red. For me, is interesting to see this date in the right format.
This is the Date as I am seeing in the Metadata payload: 2021-04-04T12:33:50.178819382Z. Right now is + 3 hours. Also my pointing router is brazil.thethings.network
It is not a point of view, it is the reality. How you set your PyGate to provide the right time and set the time zone is probably better asked at the pycom forum, they know the firmware and there will probably be more pygate owners over there.