Gateway timestamps in uplink metadata - how calculated?

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.