← All procedures

quantity.toNanoseconds

This function gives a time as a whole number of nanoseconds, or refuses it. A double holds each whole nanosecond for approximately 104 days.

CLI
Package
@procedures/quantity · README
Path
["quantity","toNanoseconds"]
CLI
mark quantity toNanoseconds --amount <object>
As data
{"$proc":["quantity","toNanoseconds"],"input":{}}

Use it

In TypeScript

import { Client, LocalTransport, PROCEDURE_REGISTRY } from "@procedures/client";
import "@procedures/quantity/register"; // registers its procedures

const client = new Client(new LocalTransport({ registry: PROCEDURE_REGISTRY }));
const result = await client.exec(["quantity","toNanoseconds"], { amount: {} });
console.log(JSON.stringify(result));

From the command line

$ mark quantity toNanoseconds --amount <object>

As data, in a program

{ "$proc": ["quantity", "toNanoseconds"], "input": { "amount": {} } }

Input

FieldTypeRequiredDefaultDescription
amountobjectyes
onobjectno

Output

The schema does not list fields (number).

JSON Schemas
{
  "input": {
    "type": "object",
    "properties": {
      "amount": {
        "type": "object",
        "properties": {
          "value": {
            "type": "number"
          },
          "unit": {
            "type": "string"
          }
        },
        "required": [
          "value",
          "unit"
        ],
        "additionalProperties": {}
      },
      "on": {
        "type": "object",
        "properties": {
          "hz": {
            "type": "number",
            "description": "The timer frequency of the kernel converts jiffies: at 250, one jiffy is 4 ms."
          }
        },
        "additionalProperties": {}
      }
    },
    "required": [
      "amount"
    ],
    "additionalProperties": false
  },
  "output": {
    "type": "number"
  }
}