Skip to content

Rounding to the quarter hour (the 7-minute rule)

The rule

Each punch is taken at the nearest quarter hour: a punch 1 to 7 minutes past a quarter rounds down to it, a punch 8 to 14 minutes past rounds up to the next. 08:07 is 08:00; 08:08 is 08:15. Over time the rounding evens out, in both directions, for in and out punches alike.

Who uses it

Employers who pay in quarter hours, from small shops to large hourly workforces, so timecards read in clean quarters. It is the most common rounding rule in the United States.

How the recipe does it

Configuration only: a package (package.toml) of one layer running the standard round step.

[[layer]]
id = "rounding"
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "15m", mode = "7m" }

mode = "7m" means: time goes down up to 7 minutes past a step, and up after. The grid of quarters runs from the start of the workday (the policy’s day_starts) on the wall clock, so it follows the clocks when they change. Raw punches are kept: the ledger shows each rounded time and a stamp saying what it was rounded from.

Parameters

ParameterMeaning
intervalThe step to round to: "15m".
mode"7m": down up to 7 minutes past a step, up after. Also "nearest", "up", "down".
punchesThe punch kinds rounded (default: every kind). See the recipe rounding_without_meals.

What the scenarios show

  • seven-down-eight-up: 08:07 down, 08:08 up, 16:52 down, 16:53 up, 07:53 up to 08:00, and a punch exactly on the quarter left as it is.
  • a-workday-starting-at-four: with the workday from 04:00 the grid still falls on the quarters, and an overnight shift stays one workday.
  • the-night-the-clocks-go-back: rounding follows the wall clock; the shift is counted as the time that really passed.

This is a common way companies implement quarter-hour rounding; check the rules where you operate. Rounding is generally allowed only when it is neutral over time, and some places do not allow it at all.

Get the recipe

The recipe’s package and its scenarios are in the example packages repository: attendance/seven_minute_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:

seven_minute_rounding/package.toml
name = "seven_minute_rounding"
version = "1.0.0"
description = "Punches are taken at the nearest quarter hour, 1 to 7 minutes past rounding down and 8 to 14 rounding up."
# Punches are rounded to the quarter hour: down up to 7 minutes past one,
# up after.
[[layer]]
id = "rounding"
[[layer.step]]
id = "round"
uses = "standard/round"
params = { interval = "15m", mode = "7m" }

Scenarios

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

With the workday starting at 04:00, the quarter-hour grid runs from 04:00; a night shift from 21:52 to 06:08 rounds to 21:45 and 06:15 and stays one workday
scenarios/a-workday-starting-at-four.toml
description = "With the workday starting at 04:00, the quarter-hour grid runs from 04:00; a night shift from 21:52 to 06:08 rounds to 21:45 and 06:15 and stays one workday"
punch = [
{ at = "2026-10-05 21:52", kind = "in" }, { at = "2026-10-06 06:08", kind = "out" },
]
[policy]
zone = "America/Chicago"
# A plant whose workday starts at 04:00.
[[layer]]
id = "day-at-four"
settings = { day_starts = "04:00" }
[expect]
week = "2026-10-05"
days = { "2026-10-05" = "8h 30m" }
segments = ["work 2026-10-05 21:45-2026-10-06 06:15"]
Punches round to the nearest quarter hour, 7 minutes down and 8 up: in at 08:07 is taken at 08:00, in at 08:08 at 08:15; out at 16:52 is taken at 16:45, out at 16:53 at 17:00; a punch exactly on the quarter stays
scenarios/seven-down-eight-up.toml
description = "Punches round to the nearest quarter hour, 7 minutes down and 8 up: in at 08:07 is taken at 08:00, in at 08:08 at 08:15; out at 16:52 is taken at 16:45, out at 16:53 at 17:00; a punch exactly on the quarter stays"
punch = [
{ at = "2026-10-05 08:07", kind = "in" }, { at = "2026-10-05 16:52", kind = "out" },
{ at = "2026-10-06 08:08", kind = "in" }, { at = "2026-10-06 16:53", kind = "out" },
{ at = "2026-10-07 07:53", kind = "in" }, { at = "2026-10-07 16:30", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-05"
segments = [
"work 2026-10-05 08:00-16:45",
"work 2026-10-06 08:15-17:00",
"work 2026-10-07 08:00-16:30",
]
allocations = [
"2026-10-05 08:00-16:45 work 8.75",
"2026-10-06 08:15-17:00 work 8.75",
"2026-10-07 08:00-16:30 work 8.50",
]
On the night the clocks go back (November 1, 2026), the grid follows the wall clock: in at 22:07 rounds to 22:00, out at 06:08 to 06:15, and the shift is an hour longer than the wall clock says: 9 hours 15 minutes
scenarios/the-night-the-clocks-go-back.toml
description = "On the night the clocks go back (November 1, 2026), the grid follows the wall clock: in at 22:07 rounds to 22:00, out at 06:08 to 06:15, and the shift is an hour longer than the wall clock says: 9 hours 15 minutes"
punch = [
{ at = "2026-10-31 22:07", kind = "in" }, { at = "2026-11-01 06:08", kind = "out" },
]
[policy]
zone = "America/Chicago"
[expect]
week = "2026-10-26"
days = { "2026-10-31" = "9h 15m" }
segments = ["work 2026-10-31 22:00-2026-11-01 06:15"]