ttd

Returns the units timetodeath (time to die).

ttd(unit) : number
-- aliases
timetodie(unit) : number

Example

if ttd('target') > 40 then
-- use our 30 second cooldowns, it's fine.
end

Note

This is an estimation, as all things math, it's not PERFECT, but it's good enough.