Crossword Genius

In fiction, he met ‘K’ roughly a moment before the end (2,3,4,2,4)

Ross

I believe the answer is:

in the nick of time

I'm a little stuck... Click here to teach me more about this clue!

'a moment before the end' is the definition.
I can't tell whether this defines the answer.

'in fiction he met k roughly' is the wordplay.
'roughly' indicates anagramming the letters.
'fiction'+'he'+'met'+'k'='fictionhemetk'
'fictionhemetk' is an anagram of 'thenickoftime'.
'in'+'thenickoftime'='IN THE NICK OF TIME'

Can you help me to learn more?

(Other definitions for in the nick of time that I've seen before include "at the eleventh hour" , "almost, but not quite, too late" , "not a moment too soon" , "at the critical moment" , "at last possible moment" .)

I've seen this clue in the Sydney Morning Herald.
Want a hint initially instead of a full solution? Install my app