Skip to content

Main content

Sleep Diary Midnight Duration Tool

Calculate a sleep-diary clock interval with an explicit next-day flag, assuming a 24-hour civil day without daylight-saving transitions.

Loading tool…

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

  1. Enter bedMinuteOfDay, wakeMinuteOfDay, nextDay. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
bedMinuteOfDayBed Minute Of DayRequired. Safe integer; minimum 0; maximum 1439.
wakeMinuteOfDayWake Minute Of DayRequired. Safe integer; minimum 0; maximum 1439.
nextDayNext DayRequired. Boolean.
Output fieldInterpretationReturned shape
durationMinutesDuration MinutesRequired. Safe integer.
json
{
  "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

  1. Calculation and input contract: health/sleep-diary-midnight-duration — tool.io

Similar or alternative tools