Skip to content

Rounding to the tenth of an hour

The rule

Each punch is taken at the nearest tenth of an hour, 6 minutes: 1 or 2 minutes past a tenth rounds down, 3 to 5 rounds up. Hours then read in tenths (8.5, 8.3) with nothing left over.

Who uses it

Employers whose payroll pays in tenths of an hour, and those billing clients by the tenth (staffing agencies, field services).

How the recipe does it

Configuration only: a package (package.toml) of one layer, which shows hours in one decimal and runs the standard round step.

[[layer]]
id = "rounding"
settings = { decimals = 1 }
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "6m" }

The default mode is "nearest": exactly halfway (3 minutes past) rounds up. Every punch is rounded, lunch punches included; to leave those alone, see rounding_without_meals.

Parameters

ParameterMeaning
interval"6m", a tenth of an hour.
mode"nearest" (default), or "up", "down", or a duration such as "2m" (down up to 2 minutes past, up after).

What the scenarios show

  • to-the-nearest-six-minutes: 2 minutes past down, 3 up, on a tenth unchanged, in and out.
  • every-punch-of-a-split-day: each punch is rounded on its own, so each stretch is a whole number of tenths.

This is a common way companies implement tenth-of-an-hour rounding; check the rules where you operate. Rounding is generally allowed only when it is neutral over time.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/tenth_hour_rounding. Test it, or your own copy of it, with hourctl attend test, and publish it with hourctl attend pkg publish.

The policy package

The package’s layers, with the standard steps each one runs and their settings:

tenth_hour_rounding/package.toml
name = "tenth_hour_rounding"
version = "1.0.0"
description = "Punches are taken at the nearest 6 minutes, so every stretch of work is a whole number of tenths of an hour."
# Hours in one decimal; every punch is rounded to the nearest 6 minutes.
[[layer]]
id = "rounding"
settings = { decimals = 1 }
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "6m" }

Scenarios

Each scenario gives a person’s punches and setup and the timecard they must produce, worked out with this package adopted (the format).

Every punch is rounded, not the day's total: out for lunch at 12:04 is 12:06, back at 12:31 is 12:30; the day's two stretches are 4.1 and 4.6 hours, each a whole number of tenths
scenarios/every-punch-of-a-split-day.toml
description = "Every punch is rounded, not the day's total: out for lunch at 12:04 is 12:06, back at 12:31 is 12:30; the day's two stretches are 4.1 and 4.6 hours, each a whole number of tenths"
punch = [
{ at = "2026-10-05 07:58", kind = "in" }, { at = "2026-10-05 12:04", kind = "out" },
{ at = "2026-10-05 12:31", kind = "in" }, { at = "2026-10-05 17:05", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-05"
allocations = [
"2026-10-05 08:00-12:06 work 4.1",
"2026-10-05 12:30-17:06 work 4.6",
]
Punches round to the nearest tenth of an hour (6 minutes): 08:02 is 08:00, 08:03 (halfway) is 08:06; 16:32 is 16:30, 16:33 is 16:36; a punch exactly on a tenth stays
scenarios/to-the-nearest-six-minutes.toml
description = "Punches round to the nearest tenth of an hour (6 minutes): 08:02 is 08:00, 08:03 (halfway) is 08:06; 16:32 is 16:30, 16:33 is 16:36; a punch exactly on a tenth stays"
punch = [
{ at = "2026-10-05 08:02", kind = "in" }, { at = "2026-10-05 16:32", kind = "out" },
{ at = "2026-10-06 08:03", kind = "in" }, { at = "2026-10-06 16:33", kind = "out" },
{ at = "2026-10-07 08:06", kind = "in" }, { at = "2026-10-07 16:24", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-05"
segments = [
"work 2026-10-05 08:00-16:30",
"work 2026-10-06 08:06-16:36",
"work 2026-10-07 08:06-16:24",
]
allocations = [
"2026-10-05 08:00-16:30 work 8.5",
"2026-10-06 08:06-16:36 work 8.5",
"2026-10-07 08:06-16:24 work 8.3",
]
paid = "25.3"