Time-shift attack in practical quantum cryptosystems