Clock Window Union Duration
Merge overlapping civil clock windows after overnight splitting and count covered seconds once on the fixed day.
Description
Merge overlapping civil clock windows after overnight splitting and count covered seconds once on the fixed day.
Clock-window union avoids double-counting overlaps and splits overnight intervals at the day boundary.
When to use this tool
Merge overlapping civil clock windows after overnight splitting and count covered seconds once on the fixed day.
- Prepare the supplied windowsJson fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter windowsJson. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.segments, result.duration. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Parse windowsJson as second-of-day pairs. Split any reversed pair into [start,86400) and [0,end), discard empty spans, merge overlapping or touching spans and sum their lengths.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| windowsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.
[
{
"field": "windowsJson",
"decoded": [
[
80000,
100
],
[
50,
200
]
]
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.segments | The segments list in the ordering and representation described above. |
| result.duration | The duration value under the stated formula or text convention. |
{
"input": {
"windowsJson": "[[80000,100],[50,200]]"
},
"output": {
"result": {
"segments": [
[
0,
200
],
[
80000,
86400
]
],
"duration": 6600
}
}
} Limitations and assumptions
- The clock is a fixed 86,400-second cycle. Equal endpoints mean an empty window, not all day; no date or daylight-saving transition is modeled.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Keep elapsed durations, circular clocks, calendar months and epoch offsets distinct. Use a date/time method with explicit timezone and timescale rules for dated instants; arithmetic on one representation does not supply the others.
References
Similar or alternative tools
- Clock Value Window Membership
Test half-open forward clock-window membership including overnight wrap; equal endpoints denote an empty window.
- Clock Window Day Splitter
Split each ordinary or overnight half-open civil clock window into same-day segments; no time-zone inference.