Libraryless. Click here for Pure Java version (7918L/44K).
1 | sclass Timeout {
|
2 | long started, deadline; |
3 | |
4 | *(double seconds) {
|
5 | started = now(); |
6 | deadline = started+toMS(seconds); |
7 | } |
8 | |
9 | bool reached aka get() {
|
10 | ping(); |
11 | ret now() >= deadline; |
12 | } |
13 | |
14 | double elapsedSeconds() {
|
15 | ret elapsedSeconds_now(started); |
16 | } |
17 | } |
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: | 407 / 589 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |