Description
Subtract bedtime from wake and add 1440 only when nextDay; reject a negative result.
Sleep summaries depend on how sleep time and the observation interval were recorded. A time ratio or clock difference is descriptive; it does not establish sleep quality, a diagnosis, or a treatment need.
Subtract bedtime from wake and add 1440 only when nextDay; reject a negative result.
When to use this tool
Use Sleep Diary Midnight Duration when you need one supplied sleep-record duration or ratio under an explicit overnight convention.
How to use the tool and how it works
- Enter bedMinuteOfDay, wakeMinuteOfDay, nextDay. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read durationMinutes. Use the output convention below.
Require bedtime and wake clock minutes in 0-1439. Subtract bedtime from wake and add 1440 only when nextDay; reject a negative result.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| bedMinuteOfDay | Bed Minute Of Day | Required. Safe integer; minimum 0; maximum 1439. |
| wakeMinuteOfDay | Wake Minute Of Day | Required. Safe integer; minimum 0; maximum 1439. |
| nextDay | Next Day | Required. Boolean. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| durationMinutes | Duration Minutes | Required. Safe integer. |
{
"input": {
"bedMinuteOfDay": 1380,
"wakeMinuteOfDay": 420,
"nextDay": true
},
"output": {
"durationMinutes": 480
}
} Limitations and assumptions
- Equal clock times can mean zero or 24 hours depending on nextDay; dates, daylight-saving changes, naps, and actual sleep time are not inferred.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Use a complete sleep record and discuss persistent concerns with an appropriate health professional.
References
Similar or alternative tools
- Sleep Log Inbed Vs Asleep Gap
Return their difference as awakeInBedMinutes and 100 × asleep/in-bed as sleepEfficiencyPercent.
- Rehearsal Call To Entrance Gap
Return entrance minus call as preparationMinutes.