X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbackend%2FTTYSessionInfo.java;h=67b2e5c4b9f357e125cb4077ec1e38a0d76e49fc;hb=b6faeac0d9c3e3ae3376ed28b54ec6ea6408ad7a;hp=e69fc7018664b4c25515040c55aedc46d2501c04;hpb=42873e30bf487bc0b695d60652dba44f82185dbb;p=nikiroo-utils.git diff --git a/src/jexer/backend/TTYSessionInfo.java b/src/jexer/backend/TTYSessionInfo.java index e69fc70..67b2e5c 100644 --- a/src/jexer/backend/TTYSessionInfo.java +++ b/src/jexer/backend/TTYSessionInfo.java @@ -31,7 +31,6 @@ package jexer.backend; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; -import java.util.Date; import java.util.StringTokenizer; /** @@ -64,7 +63,7 @@ public final class TTYSessionInfo implements SessionInfo { /** * Time at which the window size was refreshed. */ - private Date lastQueryWindowTime; + private long lastQueryWindowTime; /** * Username getter. @@ -180,12 +179,13 @@ public final class TTYSessionInfo implements SessionInfo { * Re-query the text window size. */ public void queryWindowSize() { - if (lastQueryWindowTime == null) { - lastQueryWindowTime = new Date(); + if (lastQueryWindowTime == 0) { + lastQueryWindowTime = System.currentTimeMillis(); } else { - Date now = new Date(); - if (now.getTime() - lastQueryWindowTime.getTime() < 3000) { - // Don't re-spawn stty, it's been too soon. + long nowTime = System.currentTimeMillis(); + if (nowTime - lastQueryWindowTime < 1000) { + // Don't re-spawn stty if it hasn't been a full second since + // the last time. return; } }