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

5
LINES

< > BotCompany Repo | #1026042 // doWithSleep - execute runnable and sleep afterwards if it didn't take long enough

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

Libraryless. Click here for Pure Java version (2175L/14K).

1  
svoid doWithSleep(double seconds, Runnable r) {
2  
  long time = sysNow();
3  
  callF(r);
4  
  sleepUntilSys(time+toMS(seconds));
5  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1026042
Snippet name: doWithSleep - execute runnable and sleep afterwards if it didn't take long enough
Eternal ID of this version: #1026042/2
Text MD5: 5f73a919e4eef5a224bc964a9a0abc6a
Transpilation MD5: 299093eb5100b78cbbae43131444aab8
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-13 23:17:44
Source code size: 126 bytes / 5 lines
Pitched / IR pitched: No / No
Views / Downloads: 204 / 290
Version history: 1 change(s)
Referenced in: [show references]