scope machineTime. static long #last; static long machineTime() { lock #lock; long offset = machineTimeOffset(); long value = now()+offset; if (value < last) { long newOffset = offset + last-value+1000; setMachineTimeOffset(newOffset); logQuoted(javaxDataDir("machine-time-events"), "Machine time change occurred!! " + offset + " -> " + newOffset + " at " + now() + " (" + localDateWithMilliseconds() + ")"); offset = newOffset; value = now()+offset; } last = value; ret value; } end scope
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: | #1015652 |
Snippet name: | machineTime - a time value that is guaranteed to increase; starts as equal to now() and is adjusted when system clock changes backwards |
Eternal ID of this version: | #1015652/4 |
Text MD5: | 9bc2d3ad0820d0eb614ce19e2103f5ab |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-20 15:54:22 |
Source code size: | 545 bytes / 20 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 312 / 341 |
Version history: | 3 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1015653 - machineTimeOffset - TODO: reload sometimes |