If you listen for the COMBAT_LOG_EVENT_UNFILTERED event and its SPELL_AURA_APPLIED sub-event, that only fires when a DoT is first applied, so if you get the duration of it at that time it should be the correct base one. This is correctly printing "18" every time I first apply Shadow Word: Pain to my target, for example:
Code:
local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(self, event, ...)
local _, subevent, _, srcGUID, _, _, _, tarGUID, _, _, _, _, spellName = ...
if subevent == "SPELL_AURA_APPLIED"
and srcGUID == UnitGUID("player")
and tarGUID == UnitGUID("target")
and spellName == "Shadow Word: Pain" then
local _, _, _, _, _, duration = UnitDebuff("target", "Shadow Word: Pain", "", "PLAYER")
print(duration)
end
end)