mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
commit
923c69943f
@ -24,12 +24,12 @@ import {iTutorialSteps, iTutorialNextStep,
|
|||||||
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
iTutorialIsRunning, currITutorialStep} from "./InteractiveTutorial";
|
||||||
import {evaluateImport} from "./NetscriptEvaluator";
|
import {evaluateImport} from "./NetscriptEvaluator";
|
||||||
import {NetscriptFunctions} from "./NetscriptFunctions";
|
import {NetscriptFunctions} from "./NetscriptFunctions";
|
||||||
import {addWorkerScript, killWorkerScript,
|
import {addWorkerScript,
|
||||||
WorkerScript} from "./NetscriptWorker";
|
WorkerScript} from "./NetscriptWorker";
|
||||||
import {Player} from "./Player";
|
import {Player} from "./Player";
|
||||||
import {AllServers, processSingleServerGrowth} from "./Server";
|
import {AllServers, processSingleServerGrowth} from "./Server";
|
||||||
import {Settings} from "./Settings";
|
import {Settings} from "./Settings";
|
||||||
import {post, Terminal} from "./Terminal";
|
import {post} from "./Terminal";
|
||||||
import {TextFile} from "./TextFile";
|
import {TextFile} from "./TextFile";
|
||||||
|
|
||||||
import {parse, Node} from "../utils/acorn";
|
import {parse, Node} from "../utils/acorn";
|
||||||
@ -39,6 +39,7 @@ import {Reviver, Generic_toJSON,
|
|||||||
import {compareArrays} from "../utils/helpers/compareArrays";
|
import {compareArrays} from "../utils/helpers/compareArrays";
|
||||||
import {createElement} from "../utils/uiHelpers/createElement";
|
import {createElement} from "../utils/uiHelpers/createElement";
|
||||||
import {formatNumber} from "../utils/StringHelperFunctions";
|
import {formatNumber} from "../utils/StringHelperFunctions";
|
||||||
|
import {getTimestamp} from "../utils/helpers/getTimestamp";
|
||||||
import {roundToTwo} from "../utils/helpers/roundToTwo";
|
import {roundToTwo} from "../utils/helpers/roundToTwo";
|
||||||
|
|
||||||
var keybindings = {
|
var keybindings = {
|
||||||
@ -962,7 +963,7 @@ RunningScript.prototype.log = function(txt) {
|
|||||||
}
|
}
|
||||||
let logEntry = txt;
|
let logEntry = txt;
|
||||||
if (FconfSettings.ENABLE_TIMESTAMPS) {
|
if (FconfSettings.ENABLE_TIMESTAMPS) {
|
||||||
logEntry = "[" + Terminal.getTimestamp() + "] " + logEntry;
|
logEntry = "[" + getTimestamp() + "] " + logEntry;
|
||||||
}
|
}
|
||||||
this.logs.push(logEntry);
|
this.logs.push(logEntry);
|
||||||
this.logUpd = true;
|
this.logUpd = true;
|
||||||
|
@ -38,6 +38,7 @@ import {containsAllStrings, longestCommonStart,
|
|||||||
import {addOffset} from "../utils/helpers/addOffset";
|
import {addOffset} from "../utils/helpers/addOffset";
|
||||||
import {isString} from "../utils/helpers/isString";
|
import {isString} from "../utils/helpers/isString";
|
||||||
import {arrayToString} from "../utils/helpers/arrayToString";
|
import {arrayToString} from "../utils/helpers/arrayToString";
|
||||||
|
import {getTimestamp} from "../utils/helpers/getTimestamp";
|
||||||
import {logBoxCreate} from "../utils/LogBox";
|
import {logBoxCreate} from "../utils/LogBox";
|
||||||
import {yesNoBoxCreate,
|
import {yesNoBoxCreate,
|
||||||
yesNoBoxGetYesButton,
|
yesNoBoxGetYesButton,
|
||||||
@ -115,7 +116,7 @@ $(document).keydown(function(event) {
|
|||||||
if (command.length > 0) {
|
if (command.length > 0) {
|
||||||
post(
|
post(
|
||||||
"[" +
|
"[" +
|
||||||
(FconfSettings.ENABLE_TIMESTAMPS ? Terminal.getTimestamp() + " " : "") +
|
(FconfSettings.ENABLE_TIMESTAMPS ? getTimestamp() + " " : "") +
|
||||||
Player.getCurrentServer().hostname +
|
Player.getCurrentServer().hostname +
|
||||||
" ~]> " + command
|
" ~]> " + command
|
||||||
);
|
);
|
||||||
@ -646,11 +647,6 @@ let Terminal = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getTimestamp: function() {
|
|
||||||
let d = new Date();
|
|
||||||
return (d.getMonth() + "/" + d.getDay() + " " + d.getHours() + ":" + d.getMinutes());
|
|
||||||
},
|
|
||||||
|
|
||||||
finishAction: function(cancelled = false) {
|
finishAction: function(cancelled = false) {
|
||||||
if (Terminal.hackFlag) {
|
if (Terminal.hackFlag) {
|
||||||
Terminal.finishHack(cancelled);
|
Terminal.finishHack(cancelled);
|
||||||
|
9
utils/helpers/getTimestamp.ts
Normal file
9
utils/helpers/getTimestamp.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export function getTimestamp() {
|
||||||
|
const d: Date = new Date();
|
||||||
|
// A negative slice value takes from the end of the string rather than the beginning.
|
||||||
|
const stringWidth: number = -2;
|
||||||
|
const formattedHours: string = `0${d.getHours()}`.slice(stringWidth);
|
||||||
|
const formattedMinutes: string = `0${d.getMinutes()}`.slice(stringWidth);
|
||||||
|
|
||||||
|
return `${d.getMonth() + 1}/${d.getDate()} ${formattedHours}:${formattedMinutes}`;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user