1 | static bool expectTimeJump(double secondsToWait, O onMessage) { |
2 | long diff = now()-sysNow(); |
3 | long start = sysNow(); |
4 | while (elapsedSeconds(start) < secondsToWait) { |
5 | sleep(500); |
6 | long diff2 = now()-sysNow()-diff; |
7 | if (abs(diff2) > 100) { |
8 | logQuotedWithDate(timeJumpLog(), diff2 + " ms"); |
9 | ret true with callF(onMessage, "Slept " + formatDouble(toSeconds(diff2), 1) + " seconds!"); |
10 | } |
11 | } |
12 | ret false with callF(onMessage, "No time jump occurred in " + secondsToWait + " seconds"); |
13 | } |
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: | #1015617 |
Snippet name: | expectTimeJump (because of wake-up from suspend mode) |
Eternal ID of this version: | #1015617/7 |
Text MD5: | 90d81c9ac35eda566f230183d5bea772 |
Author: | stefan |
Category: | javax / os |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-23 13:13:50 |
Source code size: | 520 bytes / 13 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 416 / 489 |
Version history: | 6 change(s) |
Referenced in: | [show references] |