charlespalen / AS3-NTP-Implementation

An Actionscript 3 Implementation of a NTP Client Using Adobe AIR
6 stars 0 forks source link

Issue with NTPTimeObject tmpOriginDate #1

Closed lizardon closed 11 years ago

lizardon commented 11 years ago

In NTPTimeObject in the function createNTPRequest():ByteArray

var tmpOriginDate:Date = new Date(1900,0,1,0,0,0,0);

should be changed to:

var tmpOriginDate:Date = new Date();
tmpOriginDate.setUTCFullYear(1900, 0, 1);
tmpOriginDate.setUTCHours(0,0,0,0);

this is because the Date constructor used here assumes the values are given in local time and not UTC time as required.

charlespalen commented 11 years ago

In the latest commit I just implemented this change. Again; Thank you lizardon! Great point on the UTC vs local time oversight.