Nodes/Basic data handling/Time Delta to Seconds
ComfyUI Node

Time Delta to Seconds

Time Delta to Seconds

By StableLlama·Created about a year ago·Updated about 23 hours ago· 48
Time Delta to Seconds
  • delta
  • seconds

This is the sibling of Time Delta to Milliseconds, and if you've landed here you probably already know the shape of the problem. ComfyUI hands you a duration as a TIMEDELTA object - a unitless span of time that no core node knows what to do with - and you need a plain number to feed downstream. TimeDeltaToSeconds is that number, expressed the way a human actually thinks about time: 2.5 seconds, not 2500 milliseconds.

Where it fits in the graph

ComfyUI's core ships no time types, so TIMEDELTA is a custom type that only exists inside this pack. Two nodes produce it: TimeDelta (hand-build a duration from days, hours, minutes, seconds...) and TimeDifference (subtract two DATETIME objects to measure how long a render or a video encode took). This node takes either and converts it to a FLOAT.

What it does

One line of Python under the hood:

delta.total_seconds()

Input: delta (type TIMEDELTA, required). Output: seconds (type FLOAT).

Because the output is a float, you keep fractional precision - a 12.847-second render stays 12.847, where the milliseconds twin would round it to an integer. The only thing the milliseconds variant gives you that this doesn't is an INT output; if a downstream node demands an INT, grab that one instead. If you want precision or a float, this is your node. Negative deltas (dates subtracted in the wrong order) pass straight through as negative numbers, no warning.

What to wire the output into

A FLOAT plugs into math nodes for scaling, text or display nodes for a human-readable "Render took 12.85s", or file-logging nodes if you're tracking timings across a batch. It's also handy anywhere a node wants a time-based number - schedulers and dynamic-step logic being the usual suspects.

Install

Same pack, same one-time cost. ComfyUI Manager → search "Basic data handling" → Install → restart. Or:

cd ComfyUI/custom_nodes
git clone https://github.com/StableLlama/ComfyUI-basic_data_handling

Then restart ComfyUI. No models, no dependencies - the pack's requirements.txt is empty, and the install being genuinely painless is rarer than it should be.

Troubleshooting

  • Can't connect the delta socket - it only accepts TIMEDELTA. Feeding it a DATETIME or a string won't work; run the value through TimeDifference or TimeDelta first.
  • Negative seconds - swap the argument order in TimeDifference; it computes datetime1 - datetime2.
  • Workflow reports the node missing - the whole pack installs in one go through Manager, so that's the fix.
CategoryBasic/time

Inputs (1)

NameTypeDefaultDescription
deltaTIMEDELTA

Outputs (1)

NameTypeDescription
secondsFLOAT