> For the complete documentation index, see [llms.txt](https://www.opal-rt.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opal-rt.com/docs/scopeview/use-functions/miscellaneous-functions/misc.-or-optime.md).

# Misc. | OPTIME

## OPERATION TIME – \[OPTIME]

Returns up to 6 time values crossing the threshold in function of the direction selection.

## **CATEGORY**

Miscellaneous

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FNxFb3pkRJQp8McjUUxs3%2Fimage.png?alt=media&amp;token=8a087c43-0360-440f-a135-60e96d481608" alt=""><figcaption></figcaption></figure>

## **DESCRIPTION**

Returns up to 6 time values crossing the threshold in function of the selected direction. Note that auto selection in Direction will select rising if the signal at t=0 is lower than the threshold and falling if the signal is higher than the threshold.

## **RESULT VARIABLES AND PARAMETERS**

**Result:**

<table data-header-hidden><thead><tr><th width="78.7999267578125"></th><th width="136.40008544921875"></th></tr></thead><tbody><tr><td><strong>op_t1</strong></td><td>Output time 1</td></tr><tr><td><strong>op_t2</strong></td><td>Output time 2</td></tr><tr><td><strong>op_t3</strong></td><td>Output time 3</td></tr><tr><td><strong>op_t4</strong></td><td>Output time 4</td></tr><tr><td><strong>op_t5</strong></td><td>Output time 5</td></tr><tr><td><strong>op_t6</strong></td><td>Output time 6</td></tr></tbody></table>

### **Parameters:**

<table><thead><tr><th width="112.4000244140625">Signal</th><th>Input signal</th></tr></thead><tbody><tr><td><strong>Threshold</strong></td><td>The threshold used to compare the input signal and return the output time</td></tr><tr><td><strong>Direction</strong></td><td>[auto] : If input(0) >= Threshold, Direction = falling. If input(0) &#x3C; Threshold, Direction = rising</td></tr><tr><td>[ <strong>rising</strong>]</td><td>Output time will be the first six rising edge that cross the threshold</td></tr><tr><td>[ <strong>falling</strong>]</td><td>Output time will be the first six falling edge that cross the threshold</td></tr><tr><td>[ <strong>both</strong>]</td><td>Output time will be the first six rising and falling edges that cross the threshold</td></tr><tr><td><strong>Reference Time</strong></td><td>The output time is represented by the crossing time-shifted by the reference time. If the first crossing occurs at t=1.0 and Reference Time = 0.25, op_t1 will be 0.75.</td></tr></tbody></table>

## **SYNTAX**

**\[op\_t1,op\_t2,op\_t3,op\_t4,op\_t5,op\_t6]**=optime(Input,Threshold,both,Time\_Shift)

## **CHARACTERISTICS**

Data type support

Double Floating point

## **EXAMPLE**

Where Threshold = 0.5 and Time\_Shift = 0

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FdLWXkHBud2t0ADaILacm%2Fimage.png?alt=media&amp;token=89c74c85-d193-491d-b14b-9ce14c3f57b2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FdUJHOLCtW5dSOTqYtLrW%2Fimage.png?alt=media&amp;token=92cbe377-0d66-40d3-ae07-9bff236e3b38" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FDlAKunewLlvcql0KwW6O%2Fimage.png?alt=media&amp;token=38fdbd74-b40b-44dc-a289-6801aeaf4df0" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2F4JHtbUKNI556iqg9apSr%2Fimage.png?alt=media&amp;token=f50572f1-922d-4ce9-82ee-e6a630988fb4" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FgBuOjVBDrsdjPdaIZ4Xa%2Fimage.png?alt=media&amp;token=ab81d2bb-ad98-4e8a-9148-97f8c4356ac1" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2Fj6P48EhRumnbwFDQdPUV%2Fimage.png?alt=media&amp;token=50f4e5ec-cde9-4c68-b4b2-bce3d904b953" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1028368895-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfwfLeQP2Iaoefor0ZUNi%2Fuploads%2FrDVzxu6ceiCaVHzEaaW9%2Fimage.png?alt=media&amp;token=89f6a74f-17f5-4d1b-b652-760d8737f6f8" alt=""><figcaption></figcaption></figure>


---

# 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://www.opal-rt.com/docs/scopeview/use-functions/miscellaneous-functions/misc.-or-optime.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.
