static bool expectTimeJump(double secondsToWait, O onMessage) { long diff = now()-sysNow(); long start = sysNow(); while (elapsedSeconds(start) < secondsToWait) { sleep(500); long diff2 = now()-sysNow()-diff; if (abs(diff2) > 100) { logQuotedWithDate(timeJumpLog(), diff2 + " ms"); ret true with callF(onMessage, "Slept " + formatDouble(toSeconds(diff2), 1) + " seconds!"); } } ret false with callF(onMessage, "No time jump occurred in " + secondsToWait + " seconds"); }
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: | 415 / 488 |
Version history: | 6 change(s) |
Referenced in: | [show references] |