OpenCL event timing gives negative execution time

I’m trying to measure the times of kernels using clGetEventProfilingInfo. This code used to work, but lately it has been giving me a lot of obviously incorrect values. I’m not sure if this is due to driver updates or changes I’ve made to the rest of the code.

A lot of the time is still gives sensible results, but some of the time it will
(a) Give an end timestamp that is before the start timestamp. Sometimes only microseconds, but I’ve seen it as high as 18ms before.
(b) Give either a start or an end timestamp of 0.

I am checking that CL_EVENT_COMMAND_EXECUTION_STATUS is CL_COMPLETE before querying the timestamps, and also checking that the return value is not CL_PROFILING_INFO_NOT_AVAILABLE. Is there anything else I’m missing?

I’m running the 313.09 driver on a GTX 480 with Ubuntu 12.04.02. I’ve also seen bogus results (not sure if it’s the same failure modes) on a Tesla C2050.