Exemple #1
0
func exchangeTimestamps() int64 {
	t0 := generateTimestamp()
	C.writeMsg(C.CString(t0))
	t2 := C.GoString(C.readMsg())
	t3 := generateTimestamp()
	C.writeMsg(C.CString(t3))
	// gotta get t1...
	t1 := C.GoString(C.readMsg())
	return calculateDelayRTT(t0, t1, t2, t3)
}
Exemple #2
0
func exchangeTimestamps() int64 {
	// client = coordinator, server = endpoints. We are server
	// t0 is the client's timestamp of the request packet transmission,
	// t1 is the server's timestamp of the request packet reception,
	t0 := C.GoString(C.readMsg())
	t1 := generateTimestamp()

	// t2 is the server's timestamp of the response packet transmission and
	// t3 is the client's timestamp of the response packet reception.
	t2 := generateTimestamp()
	C.writeMsg(C.CString(t2))
	t3 := C.GoString(C.readMsg())
	// gotta send t1
	C.writeMsg(C.CString(t1))
	//calculateClockOffset(t0, t1, t2, t3)
	return calculateDelayRTT(t0, t1, t2, t3)
}