implemented encoding/decoding for Time type