]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/commands/ReceiveCommand.java
Improve error handling of getUserStatus command for invalid phonen numbers
[signal-cli] / src / main / java / org / asamk / signal / commands / ReceiveCommand.java
index 0a38ad4e60db096de10ddd79a6a5f70ed2090842..0cd8b77bfdaded5a6a179a1cc5574dada0c0c1e6 100644 (file)
@@ -17,8 +17,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
+import java.time.Duration;
 import java.util.List;
-import java.util.concurrent.TimeUnit;
 
 public class ReceiveCommand implements LocalCommand {
 
@@ -59,7 +59,7 @@ public class ReceiveCommand implements LocalCommand {
             if (timeout < 0) {
                 m.receiveMessages(handler);
             } else {
-                m.receiveMessages((long) (timeout * 1000), TimeUnit.MILLISECONDS, handler);
+                m.receiveMessages(Duration.ofMillis((long) (timeout * 1000)), handler);
             }
         } catch (IOException e) {
             throw new IOErrorException("Error while receiving messages: " + e.getMessage(), e);