The nick of time (6)
I believe the answer is:
prison
'the nick' is the definition.
(British slang)
I cannot understand how the rest of the clue works.
Can you help me to learn more?
(Other definitions for prison that I've seen before include "Correctional institution" , "punishment" , "Place of confinement" , "Wormwood Scrubs, for example" , "Place of incarceration" .)