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

13
LINES

< > BotCompany Repo | #1015617 // expectTimeJump (because of wake-up from suspend mode)

JavaX fragment (include)

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: 417 / 489
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1015620 - timeJumpDetector (notices wake-up from suspend/hibernate mode)