Format time in ns.sleep and ns.asleep (#806)

This commit is contained in:
Jesse Clark 2023-09-17 12:40:25 -07:00 committed by GitHub
parent 47176b7809
commit b9d13063ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -236,7 +236,7 @@ export const ns: InternalAPI<NSFull> = {
(ctx) => (ctx) =>
(_time = 0) => { (_time = 0) => {
const time = helpers.number(ctx, "time", _time); const time = helpers.number(ctx, "time", _time);
helpers.log(ctx, () => `Sleeping for ${time} milliseconds`); helpers.log(ctx, () => `Sleeping for ${convertTimeMsToTimeElapsedString(time, true)}.`);
return helpers.netscriptDelay(ctx, time).then(function () { return helpers.netscriptDelay(ctx, time).then(function () {
return Promise.resolve(true); return Promise.resolve(true);
}); });
@ -245,7 +245,7 @@ export const ns: InternalAPI<NSFull> = {
(ctx) => (ctx) =>
(_time = 0) => { (_time = 0) => {
const time = helpers.number(ctx, "time", _time); const time = helpers.number(ctx, "time", _time);
helpers.log(ctx, () => `Sleeping for ${time} milliseconds`); helpers.log(ctx, () => `Sleeping for ${convertTimeMsToTimeElapsedString(time, true)}.`);
return new Promise((resolve) => setTimeout(() => resolve(true), time)); return new Promise((resolve) => setTimeout(() => resolve(true), time));
}, },
grow: grow: