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

00000000

Seconds

01000000

Minutes

10000000

Hours

11000000

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

Last updated