> For the complete documentation index, see [llms.txt](https://support.powerio.com/hub/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/general/ctime.md).

# CTime

## `CTime` (FB)

FUNCTION\_BLOCK CTime

### Short description

> Conversion of a time input (UDINT) into a time output (TIME). The scaling for the time input can be selected. Automatic calculation of min/max limits for the input as well as monitoring of the input.

### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-bf4f0edd593fa7e4ca6889aab1424a9dbb2e748f%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### Interfaces

#### Inputs

#### Outputs

| Name         | Data type | Value range      | Initial value | Function                                      |
| ------------ | --------- | ---------------- | ------------- | --------------------------------------------- |
| *tOutTime*   | TIME      | 0 … 4294967295ms |               | Time value in TIME format                     |
| *udiMinVisu* | UDINT     |                  |               | Display of **tMinTime** for the visualization |
| *udiMaxVisu* | UDINT     |                  |               | Display of **tMaxTime** for the visualization |

#### Setpoints / Parameters

| Name           | Data type | Value range          | Initial value | Function                                                              |
| -------------- | --------- | -------------------- | ------------- | --------------------------------------------------------------------- |
| **udiTime**    | UDINT     | 0 … 4294967295       |               | Time input (absolute limits: 0..7 days) depending on scaling          |
| **eTimeScale** | eTime     | Second, Minute, Hour | eTime.Second  | Definition of the scaling of the time input (seconds, minutes, hours) |
| **tMinTime**   | TIME      | 0 … 4294967295ms     | 0s            | Lower limit for the time input **udiTime**                            |
| **tMaxTime**   | TIME      | 0 … 4294967295ms     | 2h            | Upper limit for the time input **udiTime**                            |

### Functional description

#### General

This function block is used to convert a time input **udiTime** into a time output *tOutTime*.\
The scaling for the time input **udiTime** is performed via the setpoint and parameter **eTimeScale**.\
The time input is absolutely limited to a value range of 0 … 7 days.\
The time input is limited by a lower limit **tMinTime** and an upper limit **tMaxTime** are limited, both limits are also subject to scaling.\
The time output *tOutTime* is also limited accordingly to the range **tMinTime** - **tMaxTime** .\
If the lower limit **tMinTime** exceeds the upper limit **tMaxTime**, then the lower limit **tMinTime** is reduced to the upper limit.\
This function block can be used, for example, for input in a visualization.

### Visualization

Suitable visualization element from the HVACV Visu Library: **CTime** and **CTime\_single\_input**

#### Representation

<figure><img src="https://2592874069-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQR4vCFzt6ixgsqlR3pdR%2Fuploads%2Fgit-blob-f0689f82472973a805aeebd01d8fc26ddfa4de68%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Interfaces visualization element

<table><thead><tr><th>Name</th><th>Data type</th><th>Type</th><th width="150.7777099609375">Initial value</th><th>Function</th></tr></thead><tbody><tr><td><strong>FB_CTime</strong></td><td>CTime</td><td>VAR_IN_OUT</td><td></td><td>Enter the FB instance CTime here e.g. PRG.CTime</td></tr><tr><td><strong>sDialogTitle</strong></td><td>STRING</td><td>VAR_INPUT</td><td></td><td>Enter the title in string format e.g.: ‘Input room temperature’ - appears in the numpad during input.</td></tr><tr><td><strong>iFieldSizeL</strong></td><td>INT</td><td>VAR_INPUT</td><td>0</td><td>Field expands by the number of pixels entered to the left. Required to display long numbers or units.</td></tr><tr><td><strong>iFieldSizeR</strong></td><td>INT</td><td>VAR_INPUT</td><td>0</td><td>Field expands by the number of pixels entered to the right. Required to display long numbers or units.</td></tr></tbody></table>

The unit second ‘s’ minute ‘m’ or hour ‘h’ is automatically adjusted via the setting in the FB CTime. The MIN and MAX input limit is also automatically generated by the FB and adjusted in the visu element. Can be changed at runtime!

{% hint style="info" %}
Note: VAR\_IN\_OUT interfaces must be assigned; VAR\_INPUT is optional.
{% endhint %}

The visualization element **CTime\_single\_input** works like **CTime** however, all inputs must be entered separately via the interfaces. This visualization element can therefore also be used without your CTime block.

#### Interfaces visu element CTime\_single\_input

| Name             | Data type  | Type         | Initial value | Function                                                                                               |
| ---------------- | ---------- | ------------ | ------------- | ------------------------------------------------------------------------------------------------------ |
| **udiTime**      | UDINT      | VAR\_IN\_OUT |               | Enter the UDINT variable here.                                                                         |
| **eTimeScale**   | HVAC.eTime | VAR\_INPUT   |               | Here the enum eTimeScale can be entered. Displays whether second, minute or hour.                      |
| **udiMinVisu**   | UDINT      | VAR\_INPUT   | 0             | Here the MIN input limit can be entered. Inputs below this will not be accepted by the visualization.  |
| **udiMaxVisu**   | UDINT      | VAR\_INPUT   | 7200          | Here the MAX input limit can be entered. Inputs above this will not be accepted by the visualization.  |
| **sDialogTitle** | STRING     | VAR\_INPUT   |               | Enter the title in string format e.g.: ‘Input run-on time’ - appears in the numpad during input.       |
| **iFieldSizeL**  | INT        | VAR\_INPUT   | 0             | Field expands by the number of pixels entered to the left. Required to display long numbers or units.  |
| **iFieldSizeR**  | INT        | VAR\_INPUT   | 0             | Field expands by the number of pixels entered to the right. Required to display long numbers or units. |

### CODESYS

InOut:

| Scope       | Name         | Type    | Initial        |
| ----------- | ------------ | ------- | -------------- |
| Input Const | `tMaxTime`   | `TIME`  | TIME#120m0s0ms |
| Input Const | `tMinTime`   | `TIME`  | TIME#0ms       |
| Input Const | `eTimeScale` | eTime   | eTime.Second   |
| Input Const | `udiTime`    | `UDINT` |                |
| Output      | `tOutTime`   | `TIME`  |                |
| Output      | `udiMinVisu` | `UDINT` |                |
| Output      | `udiMaxVisu` | `UDINT` |                |


---

# 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://support.powerio.com/hub/codesys-hvac/en/hvac-library/functionblocks/general/ctime.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.
