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

26
LINES

< > BotCompany Repo | #1027019 // When Was Computer Booted

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 6315K of libraries. Click here for Pure Java version (5105L/26K).

1  
!7
2  
3  
cmodule WhenBooted > DynPrintLogAndEnabled {
4  
  long value;
5  
  double threshold = 2.0; // minimum difference in seconds that registers
6  
  
7  
  start {
8  
    if (value != 0) printValue();
9  
    doEveryAndNow(5.0, r updateStuff);
10  
  }
11  
  
12  
  void updateStuff enter {
13  
    long newValue = computerBootTimestamp();
14  
    if (value == 0) { setField(value := newValue); printValue(); }
15  
    else if (toSeconds(abs(value-newValue)) >= threshold) {
16  
      print("COMPUTER BOOT TIME CHANGED!");
17  
      vmBus_send computerBootTimestampChanged(value, newValue);
18  
      logQuotedWithDate(rebootLogFile(), "Boot timestamp changed from " + value + " to " + newValue);
19  
      setField(value := newValue); printValue();
20  
    }
21  
  }
22  
  
23  
  void printValue {
24  
    print("Computer was booted: " + formatLocalDateWithSeconds(value));
25  
  }
26  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027019
Snippet name: When Was Computer Booted
Eternal ID of this version: #1027019/3
Text MD5: 61e4f0e3eb10aa0e07f2755a4f04321c
Transpilation MD5: 08859dddc8803b83dc9478697103c34c
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-10 14:05:18
Source code size: 823 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 202 / 1643
Version history: 2 change(s)
Referenced in: [show references]