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

13
LINES

< > BotCompany Repo | #1017642 // timer_nextFireTime

JavaX fragment (include)

static long timer_nextFireTime(O timer, long now) {
  long best = 0;
  for (O entry : unnull((Collection) getOpt(timer, 'entries))) {
    Long firstTime = cast getOpt(entry, 'firstTime);
    Long period = cast getOpt(entry, 'period);
    if (firstTime != null && period != null)
      if (now >= firstTime) {
        long fireTime = now + period-((now - firstTime) % period);
        if (best == 0 || fireTime < best) best = fireTime;
      }
  }
  ret best;
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1017642
Snippet name: timer_nextFireTime
Eternal ID of this version: #1017642/2
Text MD5: 8a7a4735db862a4e9b1a36167dba98ae
Author: stefan
Category: javax / timers
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-31 13:55:02
Source code size: 472 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 321 / 351
Version history: 1 change(s)
Referenced in: [show references]