Skip to content

Commit 96222fe

Browse files
committed
Add current time in unix format
1 parent 4024d94 commit 96222fe

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/main/java/io/ipgeolocation/api/GeolocationTimezone.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ public class GeolocationTimezone {
66
private String name;
77
private Double offset;
88
private String currentTime;
9+
private Double currentTimeUnix;
910
private Boolean isDST;
1011
private Double dstSavings;
1112

1213
GeolocationTimezone(Map json) {
1314
this.name = (String) json.get("name");
1415
this.offset = (Double) json.get("offset");
1516
this.currentTime = (String) json.get("current_time");
17+
this.currentTimeUnix = (Double) json.get("current_time_unix");
1618
this.isDST = (Boolean) json.get("is_dst");
1719
this.dstSavings = (Double) json.get("dst_savings");
1820
}
@@ -29,6 +31,10 @@ public String getCurrentTime() {
2931
return currentTime;
3032
}
3133

34+
public Double getCurrentTimeUnix() {
35+
return currentTimeUnix;
36+
}
37+
3238
public Boolean isDST() {
3339
return isDST;
3440
}
@@ -39,6 +45,6 @@ public Double getDSTSavings() {
3945

4046
@Override
4147
public String toString() {
42-
return String.format("name: '%s' \noffset: '%s' \ncurrent_time: '%s' \nis_dst: '%b' \ndst_savings: '%s'", name, offset, currentTime, isDST, dstSavings);
48+
return String.format("name: '%s' \noffset: '%s' \ncurrent_time: '%s' \ncurrent_time_unix: '%s' \nis_dst: '%b' \ndst_savings: '%s'", name, offset, currentTime, currentTimeUnix, isDST, dstSavings);
4349
}
4450
}

src/main/java/io/ipgeolocation/api/IPGeolocationAPI.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ private Map<String, String> parseConnectionResponse(HttpURLConnection connection
184184

185185
private Map<String, Object> convertJSONStringToMap(String responseCode, String response){
186186
Gson gson = new Gson();
187-
Map<String,Object> map = new HashMap<String,Object>();
187+
Map<String,Object> map = new LinkedHashMap<String, Object>();
188188

189189
map = (Map<String, Object>) gson.fromJson(response, map.getClass());
190190
map.put("status", responseCode);

0 commit comments

Comments
 (0)