Signed Duration Unit Token Parser
Parse a strict signed duration token with explicit ms,s,min,h,d suffix; d is exactly 86400 seconds, not a calendar-day interval.
Description
Parse a strict signed duration token with explicit ms,s,min,h,d suffix; d is exactly 86400 seconds, not a calendar-day interval.
A signed duration token combines a decimal amount with an exact unit suffix. Converting it to seconds is arithmetic rather than calendar interpretation.
When to use this tool
Parse a strict signed duration token with explicit ms,s,min,h,d suffix; d is exactly 86400 seconds, not a calendar-day interval.
- Prepare the supplied token 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 token. 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.value, result.unit, result.seconds. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Parse a signed decimal without exponent, immediately followed by ms, s, min, h or d. Return value, unit and seconds using factors 0.001, 1, 60, 3,600 or 86,400.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| token | token. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.value | The value value under the stated formula or text convention. |
| result.unit | The unit value under the stated formula or text convention. |
| result.seconds | The seconds value under the stated formula or text convention. |
{
"input": {
"token": "-1.5min"
},
"output": {
"result": {
"value": -1.5,
"unit": "min",
"seconds": -90
}
}
} Limitations and assumptions
- No whitespace, mixed units or calendar months are accepted. A day means exactly 86,400 seconds, without timezone or daylight-saving semantics.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Use a parser for the actual target format when the task requires CSV, shell, URL, calendar or filesystem semantics. These tools implement the specific small grammars stated here, without adding those surrounding conventions.
References
Similar or alternative tools
- Balanced Parenthesis Token Splitter
Split a literal delimiter only outside balanced parentheses; parentheses are retained, quotes and escapes have no special meaning.
- Escaped Delimiter Token Joiner
Split or join an explicit backslash-escaped single-character delimiter dialect with control escapes; not CSV, shell or programming-language syntax.