Decoherence and quantum error correction in frequency standards