$ BEDTIME_LEDGER=ledger.tsv bedtime 23:00 --clock-start 2026-10-13T22:58:00 --clock-speed 60 --then 'date +%s > done'

Clock: simulated from 2026-10-13T22:58:00 at 60x.
Bedtime is 23:00 on Tue 2026-10-13.
Asking for five more minutes opens at 22:59:00, one minute before.
Each grant is half the one before. The first grant is 15 minutes.
The most that can ever be granted in total is 30 minutes.
Asking is open from 22:59:00 until 23:00:00.
five more minutes
Granted 15 minutes. Remaining that can ever be granted: 15 minutes.
Bedtime is now 23:15:00.
Asking is open from 23:14:00 until 23:15:00.
five more minutes
Granted 7 minutes 30 seconds. Remaining that can ever be granted: 7 minutes 30 seconds.
Bedtime is now 23:22:30.
Asking is open from 23:21:30 until 23:22:30.
five more minutes
Granted 3 minutes 45 seconds. Remaining that can ever be granted: 3 minutes 45 seconds.
Bedtime is now 23:26:15.
Asking is open from 23:25:15 until 23:26:15.
five more minutes
Granted 1 minute 52.5 seconds. Remaining that can ever be granted: 1 minute 52.5 seconds.
Bedtime is now 23:28:07.5.
Asking is open from 23:27:07.5 until 23:28:07.5.
five more minutes
Granted 56.25 seconds. Remaining that can ever be granted: 56.25 seconds.
Bedtime is now 23:29:03.75.
Asking is open from 23:28:03.75 until 23:29:03.75.
five more minutes
Granted 28.125 seconds. Remaining that can ever be granted: 28.125 seconds.
Bedtime is now 23:29:31.875.
Asking is open from 23:28:31.875 until 23:29:31.875.
five more minutes
Granted 14.062 seconds. Remaining that can ever be granted: 14.063 seconds.
Bedtime is now 23:29:45.937.
Asking is open from 23:28:45.937 until 23:29:45.937.
five more minutes
Not granted. The next grant would be 7.031 seconds, under the 10 second minimum. Remaining that can ever be granted: 14.063 seconds.
Bedtime.
Sleeping.

$ bedtime log

Night       Bedtime  Starts  Asks  Granted  Added                      Ended  Slept
2026-10-13  23:00    1       8     7        29 minutes 45.937 seconds  then   23:29:46

Nights recorded: 1. Nights with at least one ask: 1.

$ bedtime 23:00 --dry-run --clock-start 2026-10-13T21:00:00

Clock: simulated from 2026-10-13T21:00:00 at 1x.
Schedule of extensions, night of Tue 2026-10-13.
Bedtime is 23:00 on Tue 2026-10-13.
Asking for five more minutes opens at 22:59:00, one minute before.
Each grant is half the one before. The first grant is 15 minutes.
The most that can ever be granted in total is 30 minutes.

1. Granted 15 minutes. Remaining that can ever be granted: 15 minutes.
   Bedtime is now 23:15:00.
2. Granted 7 minutes 30 seconds. Remaining that can ever be granted: 7 minutes 30 seconds.
   Bedtime is now 23:22:30.
3. Granted 3 minutes 45 seconds. Remaining that can ever be granted: 3 minutes 45 seconds.
   Bedtime is now 23:26:15.
4. Granted 1 minute 52.5 seconds. Remaining that can ever be granted: 1 minute 52.5 seconds.
   Bedtime is now 23:28:07.5.
5. Granted 56.25 seconds. Remaining that can ever be granted: 56.25 seconds.
   Bedtime is now 23:29:03.75.
6. Granted 28.125 seconds. Remaining that can ever be granted: 28.125 seconds.
   Bedtime is now 23:29:31.875.
7. Granted 14.062 seconds. Remaining that can ever be granted: 14.063 seconds.
   Bedtime is now 23:29:45.937.
No grant 8: it would be 7.031 seconds, under the 10 second minimum.
The last possible bedtime is 23:29:45.937.
Halving rounds down to the millisecond. 11 milliseconds of the 30 minutes can never be granted.

Action: suspend (systemctl found). If that fails: lock (loginctl found). If that fails: print and exit 3.
Ledger: <temporary file>
Nothing was waited for, written or done.

$ bedtime 23:00 --dry-run --clock-start 2026-10-13T23:01:00

Clock: simulated from 2026-10-13T23:01:00 at 1x.
Schedule of extensions, night of Tue 2026-10-13.
Resuming tonight. 1 grant given, 15 minutes in total. Bedtime is 23:15:00.
Bedtime is 23:15:00 on Tue 2026-10-13.
Asking for five more minutes opens at 23:14:00, one minute before.
Each grant is half the one before. The next grant is 7 minutes 30 seconds.
The most that can ever be granted in total is 30 minutes.

2. Granted 7 minutes 30 seconds. Remaining that can ever be granted: 7 minutes 30 seconds.
   Bedtime is now 23:22:30.
3. Granted 3 minutes 45 seconds. Remaining that can ever be granted: 3 minutes 45 seconds.
   Bedtime is now 23:26:15.
4. Granted 1 minute 52.5 seconds. Remaining that can ever be granted: 1 minute 52.5 seconds.
   Bedtime is now 23:28:07.5.
5. Granted 56.25 seconds. Remaining that can ever be granted: 56.25 seconds.
   Bedtime is now 23:29:03.75.
6. Granted 28.125 seconds. Remaining that can ever be granted: 28.125 seconds.
   Bedtime is now 23:29:31.875.
7. Granted 14.062 seconds. Remaining that can ever be granted: 14.063 seconds.
   Bedtime is now 23:29:45.937.
No grant 8: it would be 7.031 seconds, under the 10 second minimum.
The last possible bedtime is 23:29:45.937.
Halving rounds down to the millisecond. 11 milliseconds of the 30 minutes can never be granted.

Action: suspend (systemctl found). If that fails: lock (loginctl found). If that fails: print and exit 3.
Ledger: <temporary file>
Nothing was waited for, written or done.

$ bedtime --help

Usage: bedtime HH:MM [--dry-run] [--lock | --then "<command>"] [--clock-start YYYY-MM-DDTHH:MM:SS [--clock-speed N]], or bedtime log
At HH:MM the machine is put to sleep. One minute before, asking opens: type five more minutes.
Each grant is half the one before. The first grant is 15 minutes. Nothing of 10 seconds or less is granted.
The most that can ever be granted in total is 30 minutes. Restarting does not return a grant.
Every start, request and end is appended to a plain ledger: $BEDTIME_LEDGER if set,
else $XDG_STATE_HOME/bedtime/ledger.tsv, else ~/.local/state/bedtime/ledger.tsv. bedtime log prints it.
normal is dead