Precise measurements of the D0 and D+ meson lifetimes