Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1033153 // Timeout

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7918L/44K).

sclass Timeout {
  long started, deadline;
  
  *(double seconds) {
    started = now();
    deadline = started+toMS(seconds);
  }
  
  bool reached aka get() {
    ping();
    ret now() >= deadline;
  }
  
  double elapsedSeconds() {
    ret elapsedSeconds_now(started);
  }
}

Author comment

Began life as a copy of #1015834

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033153
Snippet name: Timeout
Eternal ID of this version: #1033153/5
Text MD5: 6b2727c7dc57f81a097cca45df81269b
Transpilation MD5: 0ebddce217e369505c23052376c25753
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 20:03:53
Source code size: 293 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 166 / 294
Version history: 4 change(s)
Referenced in: [show references]