Mechanism for Temporal Encoding in Fear Conditioning