I am currently attempting to calculate the lag in milliseconds between my client (located in France) and my server (based in Germany).
On the Client side (Using Angular Typescript) :
this.http.getDate().subscribe(response => {
if (response.type === HttpEventType.Sent) {
const dateSent = new Date();
const dateOffset = dateSent.getTimezoneOffset();
const timeSent = dateSent.getTime() + dateOffset;
console.log(timeSent);
} else if (response instanceof HttpResponse) {
const dateReceived = new Date(response.body.dateReceived);
const timeReceived = dateReceived.getTime();
console.log(timeReceived);
}
});
On the Server side (Using Java) :
return new Date();
timeSent = 1559221214039 and timeReceived = 1559221212914
Why is there a difference of -1125 milliseconds between them? According to Firefox's developer tool, the network indicates it took 200ms.
If anyone could provide insight on what might be going wrong, it would be greatly appreciated.
Thank you for your assistance.