1
0
Fork 0
mirror of https://bitbucket.org/ethauvin/owm-japis.git synced 2025-04-25 01:47:10 -07:00

Fixed the bug affecting the date and time of retrieved data.

This commit is contained in:
Ashutosh Kumar Singh 2014-07-01 22:17:21 +05:30
parent b5fca648fe
commit 4535ffd037

View file

@ -606,7 +606,14 @@ abstract public class AbstractWeatherData {
// converting seconds to Date object
if (sec != Long.MIN_VALUE) {
this.dateTime = new Date(sec);
/*
@bugfix It always return "Sat Jan 17 04:10:42 CET 1970"
Issue: #3 given at http://code.aksingh.net/owm-japis/issue/3/problem-with-datetime
Incorrect: this.dateTime = new Date(sec);
Correct: this.dateTime = new Date(sec * 1000);
Reason: Date requires milliseconds but previously, seconds were provided.
*/
this.dateTime = new Date(sec * 1000);
} else {
this.dateTime = null;
}