mirror of
https://github.com/Prominence/openweathermap-java-api.git
synced 2026-01-09 19:46:41 +03:00
Fixed issue with datetime storing and printing.
This commit is contained in:
parent
37d9a1cf5b
commit
3bb0eb043d
@ -24,7 +24,7 @@ package by.prominence.openweather.api.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class WeatherResponse {
|
||||
@ -60,7 +60,7 @@ public class WeatherResponse {
|
||||
private Snow snow;
|
||||
|
||||
@JSONField(name = "dt")
|
||||
private LocalTime dataCalculationTime;
|
||||
private long dataCalculationTime;
|
||||
|
||||
@JSONField(name = "sys")
|
||||
private WeatherSystemInfo weatherSystemInfo;
|
||||
@ -148,11 +148,11 @@ public class WeatherResponse {
|
||||
this.snow = snow;
|
||||
}
|
||||
|
||||
public LocalTime getDataCalculationTime() {
|
||||
public long getDataCalculationTime() {
|
||||
return dataCalculationTime;
|
||||
}
|
||||
|
||||
public void setDataCalculationTime(LocalTime dataCalculationTime) {
|
||||
public void setDataCalculationTime(long dataCalculationTime) {
|
||||
this.dataCalculationTime = dataCalculationTime;
|
||||
}
|
||||
|
||||
@ -185,7 +185,7 @@ public class WeatherResponse {
|
||||
",\n clouds=" + clouds +
|
||||
",\n rain=" + rain +
|
||||
",\n snow=" + snow +
|
||||
",\n dataCalculationTime=" + dataCalculationTime +
|
||||
",\n dataCalculationTime=" + new Date(dataCalculationTime * 1000) +
|
||||
",\n weatherSystemInfo=" + weatherSystemInfo +
|
||||
",\n responseCode=" + responseCode +
|
||||
'}';
|
||||
|
||||
@ -24,7 +24,7 @@ package by.prominence.openweather.api.model;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.time.LocalTime;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
public class WeatherSystemInfo {
|
||||
@ -47,11 +47,11 @@ public class WeatherSystemInfo {
|
||||
|
||||
@JSONField(name = "sunrise")
|
||||
// Sunrise time, unix, UTC
|
||||
private LocalTime sunrise;
|
||||
private long sunrise;
|
||||
|
||||
@JSONField(name = "sunset")
|
||||
// Sunset time, unix, UTC
|
||||
private LocalTime sunset;
|
||||
private long sunset;
|
||||
|
||||
public short getType() {
|
||||
return type;
|
||||
@ -85,19 +85,19 @@ public class WeatherSystemInfo {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public LocalTime getSunrise() {
|
||||
public long getSunrise() {
|
||||
return sunrise;
|
||||
}
|
||||
|
||||
public void setSunrise(LocalTime sunrise) {
|
||||
public void setSunrise(long sunrise) {
|
||||
this.sunrise = sunrise;
|
||||
}
|
||||
|
||||
public LocalTime getSunset() {
|
||||
public long getSunset() {
|
||||
return sunset;
|
||||
}
|
||||
|
||||
public void setSunset(LocalTime sunset) {
|
||||
public void setSunset(long sunset) {
|
||||
this.sunset = sunset;
|
||||
}
|
||||
|
||||
@ -108,8 +108,8 @@ public class WeatherSystemInfo {
|
||||
", id=" + id +
|
||||
", message=" + message +
|
||||
", country='" + country + '\'' +
|
||||
", sunrise=" + sunrise +
|
||||
", sunset=" + sunset +
|
||||
", sunrise=" + new Date(sunrise * 1000) +
|
||||
", sunset=" + new Date(sunset * 1000) +
|
||||
'}';
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user