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).

!7

cmodule WhenBooted > DynPrintLogAndEnabled {
  long value;
  double threshold = 2.0; // minimum difference in seconds that registers
  
  start {
    if (value != 0) printValue();
    doEveryAndNow(5.0, r updateStuff);
  }
  
  void updateStuff enter {
    long newValue = computerBootTimestamp();
    if (value == 0) { setField(value := newValue); printValue(); }
    else if (toSeconds(abs(value-newValue)) >= threshold) {
      print("COMPUTER BOOT TIME CHANGED!");
      vmBus_send computerBootTimestampChanged(value, newValue);
      logQuotedWithDate(rebootLogFile(), "Boot timestamp changed from " + value + " to " + newValue);
      setField(value := newValue); printValue();
    }
  }
  
  void printValue {
    print("Computer was booted: " + formatLocalDateWithSeconds(value));
  }
}

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: 201 / 1641
Version history: 2 change(s)
Referenced in: [show references]