The time and date of death should be as accurate as possible.
It is not necessarily defined by when the doctor examined the body.

The Medical Certificate of Causes of Death requires "Date of death as stated to me."

Note that the Coroner has accepted that registered nurses, enrolled nurses and ambulance paramedics can confirm that death has occurred - prior to the doctor examining a body and issuing a death certificate.
- see the Ministry of Health Guidelines (page 1)

Thus, if a nurse (for example) has confirmed that a patient is dead at a defined time, the doctor can use that time as the time of death.