I've just recently watched The Machinist and in the whole movie only once I heard that Trevor Reznik said he hasn't slept for a year. Was this really the case or he just imagined he hasn't slept in a year like everything else?
I think he had awake for a year, but there's two possibilities depending on the intended realism:
He had been awake for a year (artistic licence):
Trevor would (roughly) know how long it'd been (perhaps estimating or rounding). Severe sleep deprivation can lead to many kinds of physical and mental problems including: paranoia, weight loss, hallucinations and moodiness.
The rest of the film (Trevor's physical condition, no other duration suggested) would support this.
He imagined it (more realistic):
He'd been awake for a long time but nowhere near a year, perhaps with unnoticed microsleeps.
Records for healthy individuals staying awake without stimulants is around 11 days, however patients with a sleeping disorder may stay awake far longer, the longest on record is a man with FFI (a brain disorder) at 6 months (still far shorter than Trevor).