mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
added tFormat to represent times.
This commit is contained in:
parent
3db440fd95
commit
c76110b575
15
doc/source/netscript/basicfunctions/tFormat.rst
Normal file
15
doc/source/netscript/basicfunctions/tFormat.rst
Normal file
@ -0,0 +1,15 @@
|
||||
tFormat() Netscript Function
|
||||
============================
|
||||
|
||||
.. js:function:: tFormat(milliseconds)
|
||||
|
||||
:RAM cost: 0 GB
|
||||
:param number milliseconds: Amount of milliseconds to format.
|
||||
:returns: milliseconds in the "D M H S" format
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: javascript
|
||||
|
||||
tFormat(3000); // returns: "3 seconds"
|
||||
tFormat(10000000); // returns: "2 hours 46 minutes 40 seconds"
|
@ -236,6 +236,8 @@ export let CONSTANTS: IMap<any> = {
|
||||
|
||||
Netscript
|
||||
* Ace editor will now correctly highlight all functions.
|
||||
* 'tFormat' is a new netscript function that returns a human readable
|
||||
representation of milliseconds. eg. "2 hours 15 minute 43 seconds"
|
||||
|
||||
Gang
|
||||
* style improvements
|
||||
|
@ -151,6 +151,7 @@ import { numeralWrapper } from "./ui/numeralFormat";
|
||||
import { post } from "./ui/postToTerminal";
|
||||
import { setTimeoutRef } from "./utils/SetTimeoutRef";
|
||||
import { is2DArray } from "./utils/helpers/is2DArray";
|
||||
import { convertTimeMsToTimeElapsedString } from "../utils/StringHelperFunctions";
|
||||
|
||||
import { dialogBoxCreate } from "../utils/DialogBox";
|
||||
import { formatNumber, isHTML } from "../utils/StringHelperFunctions";
|
||||
@ -2349,6 +2350,9 @@ function NetscriptFunctions(workerScript) {
|
||||
|
||||
return numeralWrapper.format(parseFloat(n), format);
|
||||
},
|
||||
tFormat: function(milliseconds) {
|
||||
return convertTimeMsToTimeElapsedString(milliseconds);
|
||||
},
|
||||
getTimeSinceLastAug: function() {
|
||||
updateDynamicRam("getTimeSinceLastAug", getRamCost("getTimeSinceLastAug"));
|
||||
return Player.playtimeSinceLastAug;
|
||||
|
@ -153,17 +153,17 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
|
||||
|
||||
<fieldset>
|
||||
<label for="script-editor-option-highlightactiveline">Highlight Active Line</label>
|
||||
<input type="checkbox" name="script-editor-option-highlightactiveline" id="script-editor-option-highlightactiveline" checked>
|
||||
<input type="checkbox" class="optionCheckbox" name="script-editor-option-highlightactiveline" id="script-editor-option-highlightactiveline" checked>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="script-editor-option-showinvisibles">Show Invisibles</label>
|
||||
<input type="checkbox" name="script-editor-option-showinvisibles" id="script-editor-option-showinvisibles">
|
||||
<input type="checkbox" class="optionCheckbox" name="script-editor-option-showinvisibles" id="script-editor-option-showinvisibles">
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<label for="script-editor-option-usesofttab">Use Soft Tab</label>
|
||||
<input type="checkbox" name="script-editor-option-usesofttab" id="script-editor-option-usesofttab" checked>
|
||||
<input type="checkbox" class="optionCheckbox" name="script-editor-option-usesofttab" id="script-editor-option-usesofttab" checked>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="script-editor-option-flex1-fieldset"></fieldset>
|
||||
|
Loading…
Reference in New Issue
Block a user