> For the complete documentation index, see [llms.txt](https://developers.newbluefx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.newbluefx.com/captivate-api/javascript-api-reference/using-the-servicehandler/additional-methods-with-scheduler.md). Agents can also search and read this documentation through its [MCP server](https://developers.newbluefx.com/~gitbook/mcp).

# Additional Methods with Scheduler

#### `getTime` method <a href="#gettime-method" id="gettime-method"></a>

Asynchronously get the current *timestamp in seconds* (floating point) since Captivate started.

```javascript
ServiceHandler.scheduler.getTime(callback);
```

* `callback`: Function taking a single argument that will receive the time value once it is retrieved.

**Example:**

```javascript
ServiceHandler.scheduler.getTime((time) => {
  // do something with time
  console.log(`Captivate has been running for ${time} seconds`);
});
```

#### `updateInputDefinition` method <a href="#updateinputdefinition-method" id="updateinputdefinition-method"></a>

Updates the definition of the named input with new variables and types. This overrides all variable definitions specified in the XML file and is necessary when a new variable name is added to the input or when a variable pattern needs to be changed. This function will also trigger a re-render on all titles connected to this input, so use it sparingly.

> **Note:** `updateInputDefinition` needs Full API Access. See [API Access Levels](https://developers.newbluefx.com/getting-started/api-access-levels.md).

```javascript
ServiceHandler.scheduler.updateInputDefinition(inputName, definition);
```

* `inputName`: Input name must match the name from the input definition XML file.
* `definition`: JavaScript object containing the new variable definitions (see below). By default, this definition will completely replace the variables defined previously. That is, new variables will be created if they weren’t defined before, and variables omitted from this definition will be deleted from the input for this project. However, you may send a `method` parameter set to one of the following values to change this behavior:
  * `reset`: All current variables will be deleted, and the supplied variables will constitute the new definition. (This is the default for backwards compatibility, but if there are a lot of variables, this might cause an expensive re-render. Use the `merge` option whenever you can.)
  * `delete`: Supplied variables will be deleted from the input definition.
  * `merge`: Supplied variables will be added to the input definition, possibly replacing previous variables.

For more information on the variable definition, see **Creating Input Behaviors** section of the [XML Definition](https://developers.newbluefx.com/captivate-api/captivate-controller-reference/xml-definition.md) page for description of definition parameters. They are the same here as in the XML specification with the exception that both attributes and child nodes from the XML are represented in JavaScript by object fields. Specifically notice that `<value>` nodes are here represented by a `values` list.

**Example:**

```javascript
const definition = {
  method: 'reset', // if omitted, `reset` is the default, may also be `delete` or `merge`
  variables: {
    'Home Score': {
      type: 'text',
    },
    'Visitor Score': {
      type: 'text',
    },
    'Shot Clock': {
      type: 'text',
      pattern: '[0-2][0-9].[0-9]',
    },
    'Period Number': {
      type: 'text',
      values: ['1', '2', '2.5', '3', '4', '5'], // 2.5 = halftime, 5 = OT
    },
  },
};

ServiceHandler.scheduler.updateInputDefinition('Simple HTML Scoreboard', definition);
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developers.newbluefx.com/captivate-api/javascript-api-reference/using-the-servicehandler/additional-methods-with-scheduler.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
