# SimpleTime

SimpleTime encoding allows you to represent a time value from 1 to 63 seconds, minutes, days, or hours in one single byte. Used commonly to encode any time needed in the API 6.

A lot of downlink register values are time intervals - timing is crucial for most use cases of SimpleHw devices. The way we encode time in  API 6 saves space as the time value takes up only **one byte**.

We call this *SimpleTime* - using this encoding, you can represent a time period of **1-63 seconds, minutes, hours, or days in a single byte**. As you know, one byte has **eight bits** - with **bits 7 and 6** (the first two from the left), you can define what **time unit** you will use. Like this:

| **Binary bits** | **Time unit** |
| --------------- | ------------- |
| **00**000000    | Seconds       |
| **01**000000    | Minutes       |
| **10**000000    | Hours         |
| **11**000000    | Days          |

**Bits 5 to 0** will then allow you to insert a **value from 0 to 63**. Efficient yet elegant.

*Examples:*

| ***Binary value*** | ***Hex value*** | ***Encoded time*** |
| ------------------ | --------------- | ------------------ |
| *00000111*         | *0x07*          | *7 seconds*        |
| *01001100*         | *0x4C*          | *12 minutes*       |
| *10000100*         | *0x84*          | *4 hours*          |
| *11010111*         | *0xD7*          | *23 days*          |


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ask.simplehw.eu/kb/simple-api-6-generation/api-6-encoding_23396515/simpletime.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
