A slave device connected to a master device having a master clock over a network, wherein the slave device includes a slave clock, and wherein: the slave device is arranged to: exchange with the master device, timing messages and record timestamps which are: the time of sending of said timing messages from the master device according to the master clock; the time of receipt of said timing messages according to the slave clock; the time of sending of said timing messages according to the slave clock; and the time of receipt of said timing messages according to the master clock; formulate and solve a linear programming problem to derive an estimate of the skew and offset of the slave clock relative to the master clock; and synchronize the slave clock to the master clock based on the estimated skew and offset to produce a master time estimate, characterized in that: the linear programming problem seeks to minimize the expression θ f - θ r in which θ f is the offset of the slave clock compared to the master clock, derived from timing messages sent from the master to the slave and θ r is the offset derived from timing messages sent from the slave to the master, subject to the constraints that T 1, n ≥ (1 + α) T 2, n + θ f, T 4, n ≤ (1 + α) T 3, n + θ r and θ f - θ r ≥ 0 wherein: α is the skew of the slave clock compared to master clock; T 1,n is the time of sending of the nth timing message from the master device according to the master clock; T 2,n is the time of receipt of the nth timing message from the master device according to the slave clock; T 3,n is the time of sending of the nth timing message from the slave device according to the slave clock; and T 4,n is the time of receipt of the nth timing message from the slave device according to the master clock. exchange with the master device, timing messages and record timestamps which are: the time of sending of said timing messages from the master device according to the master clock; the time of receipt of said timing messages according to the slave clock; the time of sending of said timing messages according to the slave clock; and the time of receipt of said timing messages according to the master clock; formulate and solve a linear programming problem to derive an estimate of the skew and offset of the slave clock relative to the master clock; and synchronize the slave clock to the master clock based on the estimated skew and offset to produce a master time estimate, characterized in that: the linear programming problem seeks to minimize the expression θ f - θ r in which θ f is the offset of the slave clock compared to the master clock, derived from timing messages sent from the master to the slave and θ r is the offset derived from timing messages sent from the slave to the master, subject to the constraints that T 1, n ≥ (1 + α) T 2, n + θ f, T 4, n ≤ (1 + α) T 3, n + θ r and θ f - θ r ≥ 0 wherein: α is the skew of the slave clock compared to master clock; T 1,n is the time of sending of the nth timing message from the master device according to the master clock; T 2,n is the time of receipt of the nth timing message from the master device according to the slave clock; T 3,n is the time of sending of the nth timing message from the slave device according to the slave clock; and T 4,n is the time of receipt of the nth timing message from the slave device according to the master clock.