diff options
author | Maurice Laveaux <maurice@localhost.localdomain> | 2014-05-26 16:49:06 +0200 |
---|---|---|
committer | Maurice Laveaux <maurice@localhost.localdomain> | 2014-05-26 16:49:06 +0200 |
commit | 0ee51c21a1cf255cc39802e4e57d4f86ee5b2330 (patch) | |
tree | 4d5c2a2d1550dcd0d95fb5365a18a0831823f6dd /src/io/Response.java | |
parent | 1a44e63644fb0809c339fe59ea47e15d1663b997 (diff) | |
download | TwitterDataAnalytics-0ee51c21a1cf255cc39802e4e57d4f86ee5b2330.tar.gz |
Improved the requester
* Reads a gzip stream.
* Uses the http request date for interval measurement.
Diffstat (limited to 'src/io/Response.java')
-rw-r--r-- | src/io/Response.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/io/Response.java b/src/io/Response.java index e5ede8a..b2681a8 100644 --- a/src/io/Response.java +++ b/src/io/Response.java @@ -11,17 +11,20 @@ public class Response { private final JsonElement element; - private final int rateLimitReset; + private final long rateLimitReset; + + private final long timeRemaining; private final int rateLimitRemaining; private final int rateLimit; - public Response(JsonElement resp, int rateLimit, int rateLimitRemaining, int rateLimitReset) { + public Response(JsonElement resp, int rateLimit, int rateLimitRemaining, long rateLimitReset, long timeRemaining) { this.element = resp; this.rateLimit = rateLimit; this.rateLimitRemaining = rateLimitRemaining; this.rateLimitReset = rateLimitReset; + this.timeRemaining = timeRemaining; } public JsonElement getJson() { @@ -36,7 +39,7 @@ public class Response { return this.rateLimitRemaining; } - public int getRateLimitReset() { + public long getRateLimitReset() { return this.rateLimitReset; } @@ -45,6 +48,6 @@ public class Response { * similar request can be executed. */ public long getRateLimitRemainingTime() { - return rateLimitReset * 1000 - System.currentTimeMillis(); + return this.timeRemaining; } } |