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

15
LINES

< > BotCompany Repo | #1013915 // renderElapsedTimePleasantly

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

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

1  
sS renderElapsedTimePleasantly(long ms default lastTiming()) {
2  
  double secs = toSeconds(ms);
3  
  if (secs >= 1) ret formatDouble(secs, 3) + " s";
4  
  ret ms + " ms";
5  
}
6  
7  
sS renderElapsedTimePleasantly(Runnable r) {
8  
  long time = sysNow();
9  
  r?.run();
10  
  ret renderElapsedTimePleasantly(sysNow()-time);
11  
}
12  
13  
sS renderElapsedTimePleasantly(Duration d) {
14  
  ret d == null ?: renderElapsedTimePleasantly(d.toMillis());
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1013915
Snippet name: renderElapsedTimePleasantly
Eternal ID of this version: #1013915/9
Text MD5: 61e200bdcffe66b8043a6511a68ade79
Transpilation MD5: 305d1ffe0aaeabb7f03848e04e10a8c9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 19:09:01
Source code size: 422 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 487 / 561
Version history: 8 change(s)
Referenced in: [show references]