According to GCKR files, most dungeons are 30 seconds, with some exceptions for beginner dungeons. For those, sometimes clear time between 24 and 30 seconds are detected, while in some cases it's not. It will definitely get detected below 20 seconds.
Not sure how they calculate the needed time, but I'm currently guessing the time between when result screen shows up(when your counter stops) and the item distributing point in that result screen counts towards time as well. Never hurts to have 30 seconds though xD