Lua Code:
local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable,
shouldConsolidate, spellId, canApplyAura, isBossDebuff, value1, value2, value3 = UnitBuff("unit", index or "name"[, "rank"[, "filter"]])
You check on the 15th argument. The time left is the expirationTime value.
Take a look at the 2nd example
http://wowpedia.org/API_UnitBuff