Skip to content

Commit 36770bd

Browse files
committed
explain time rounding
1 parent ef8cca2 commit 36770bd

File tree

2 files changed

+184
-1
lines changed

2 files changed

+184
-1
lines changed

_data/menu-documentation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ manual:
1414
name: Advanced Topics
1515
description: Articles that explain basic functionality in Kimai
1616
icon: bx bx-bulb
17-
pages: [ initial-setup, rates, billable, pdf-templates, keyboard-shortcuts, i18n-am-pm, duration-format, "-", homescreen, user-api ]
17+
pages: [initial-setup, rates, rounding, billable, pdf-templates, keyboard-shortcuts, i18n-am-pm, duration-format, "-", homescreen, user-api]
1818
cloud:
1919
slug: cloud
2020
icon: bx bx-cloud
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
title: Rounding
3+
description: "Rounding duration and rates in Kimai: Why It Matters and How It Works"
4+
---
5+
6+
Time tracking and invoicing operate on two fundamentally different mathematical bases:
7+
8+
- **Time** is measured in **base 60**
9+
- **Money** is calculated in **base 100**
10+
11+
At first glance this does not seem important, but when a system needs to combine *measured time* with *decimal invoices*, rounding becomes unavoidable.
12+
13+
This page explains why rounding is necessary, why the results might sometimes look unintuitive, and why the behavior in Kimai creates **mathematically correct** invoices that comply with accounting and e-invoicing standards.
14+
15+
## Why does rounding happen at all?
16+
17+
### Time: base 60
18+
19+
Time entries are stored in seconds.
20+
A minute has 60 seconds, an hour has 60 minutes. All divisions in this system produce repeating decimals when converted into decimal hours.
21+
22+
**Example:**
23+
24+
```
25+
5 minutes = 300 seconds
26+
300 / 3600 = 0.0833333… hours
27+
```
28+
29+
### Money: base 100
30+
31+
Prices and invoice totals must follow decimal rules.
32+
The smallest allowed monetary unit is:
33+
34+
```
35+
0.01 (one cent)
36+
```
37+
38+
### The problem
39+
40+
Decimal hours allow only two decimal places:
41+
42+
```
43+
0.0833333… rounds to 0.08 hours
44+
```
45+
46+
But if you **calculate money using the unrounded duration**, yet **display only the rounded duration**, you create an accounting mismatch.
47+
48+
This was the behavior in older Kimai versions and caused in certain circumstances real invoice validation issues.
49+
50+
## The fundamental constraint
51+
### **0.01 hours = 36 seconds**
52+
53+
To stay compatible with decimal invoices, Kimai must convert time into the smallest possible unit that works for both systems:
54+
55+
- The smallest monetary step is **0.01**
56+
- Therefor the smallest compatible duration step is:
57+
**0.01 hours × 3600 seconds = 36 seconds**
58+
59+
This means:
60+
61+
- All durations are rounded to multiples of **36 seconds**
62+
- All hourly calculations use these **rounded durations**
63+
- The result always matches:
64+
**displayed duration × hourly rate = displayed amount**
65+
66+
This ensures your invoice is mathematically correct and fully compatible with tax authorities and e-invoicing systems.
67+
68+
## Why does the rounding feel “wrong” for small durations?
69+
70+
A real example from a user question:
71+
72+
> “5 minutes used to result in 5€, now it shows 4.8€. Why?”
73+
74+
Let’s compare the **intuitive** calculation vs. the **decimal** calculation.
75+
76+
### ❌ The intuitive but incorrect expectation
77+
78+
Many people still think in "base 60" units:
79+
80+
- 1 hour = 60€
81+
- 60 minutes / 5 minutes = 12
82+
- 60€ / 12 = **5€**
83+
84+
But invoices do **not** work this way and this method ignores decimal rounding.
85+
86+
### ✔ The correct decimal calculation
87+
88+
```
89+
5 minutes = 300 seconds
90+
300 / 3600 = 0.083333… rounds to 0.08 hours
91+
60€ × 0.08 = 4.8€
92+
```
93+
94+
This is how proper decimal invoicing works.
95+
96+
### Showing `0.08h` on the invoice, but charging `5€` is **incorrect**
97+
98+
This inconsistency:
99+
100+
- violates accounting rules
101+
- can make clients reject invoices
102+
- leads to automatic validation errors in e-invoices
103+
104+
Kimai must prevent this.
105+
106+
## Example: 5 minutes (loss) and 10 minutes (gain)
107+
108+
### 5 minutes:
109+
110+
```
111+
300 sec / 3600 = 0.083333… rounds to 0.08
112+
60€ × 0.08 = 4.8€
113+
```
114+
115+
### 10 minutes:
116+
117+
```
118+
600 sec / 3600 = 0.166666… rounds to 0.17
119+
60€ × 0.17 = 10.2€
120+
```
121+
122+
As you see:
123+
124+
- Sometimes rounding means you “lose” a few cents
125+
- Sometimes you “gain” a few cents
126+
- Over time, these effects usually cancel out
127+
128+
This is normal behavior in any decimal-based billing system.
129+
130+
## Why the new method is better
131+
132+
Older versions of Kimai:
133+
134+
- **Displayed** rounded decimal hours
135+
- **Calculated** with full unrounded seconds
136+
- Produced mismatches between displayed duration and monetary total
137+
- Caused rounding inconsistencies when many entries were merged
138+
- Broke e-invoice validation rules
139+
140+
The new approach:
141+
142+
- Converts all durations into **decimal-compatible seconds** (multiples of 36)
143+
- Ensures: **displayed hours × rate = displayed money**
144+
- Completely eliminates hidden rounding differences
145+
- Produces mathematically and legally correct invoices
146+
147+
This is the only approach aligned with accounting principles.
148+
149+
## Should I round my recorded working time?
150+
151+
For many businesses: **yes**.
152+
153+
But not in the way most people think. Humans tend to round to multiples of 5 — often 10 — because it feels natural.
154+
However, when it comes to time-tracking and converting durations into decimal hours, rounding to 5 or 10 minutes
155+
**creates repeating decimals** (e.g., 10 minutes = 0.16666… hours), which can lead to unexpected results in invoices or reports.
156+
157+
To avoid this problem, it is recommended to round your recorded working time to a multiple of 3 minutes.
158+
159+
**Why 3?**
160+
161+
Because 3 minutes is 1/20 of an hour = exactly 0.05 hours. No repeating decimals.
162+
163+
Even better is rounding to 6 minutes (0.1 hours) or 15 minutes (0.25 hours), which also convert into clean decimals without fractions.
164+
165+
Common and reliable duration roundings are therefore:
166+
* 3 minutes = 0.05 h
167+
* 6 minutes = 0.1 h
168+
* 15 minutes = 0.25 h
169+
170+
These values help you **avoid all decimal rounding issues** and are widely used in many industries because they simplify both time-tracking and invoicing.
171+
172+
Of course, Kimai supports exact second-based tracking for businesses that need precise timestamps; rounding rules simply ensure that your invoice totals always remain predictable, consistent, and compliant.
173+
174+
## Summary
175+
176+
- Time is base 60, money is base 100 which is incompatible by design
177+
- Decimal hours have only 2 decimals with the smallest unit = **0.01h = 36 seconds**
178+
- Kimai rounds durations to multiples of 36 seconds
179+
- This guarantees: **displayed duration × hourly rate = displayed total**
180+
- The new rounding is mathematically correct and required for valid invoices
181+
- Small deviations for very short entries are expected and normal
182+
183+
Even if certain examples feel unintuitive at first, the new rounding system ensures that your invoices are consistent, compliant, and correct.

0 commit comments

Comments
 (0)