Turn panic to error in SystemTime serialization
@@ -616,7 +616,7 @@ impl Serialize for SystemTime {
use super::SerializeStruct;
let duration_since_epoch = self
.duration_since(UNIX_EPOCH)
- .expect("SystemTime must be later than UNIX_EPOCH");
+ .map_err(|_|S::Error::custom("SystemTime must be later than UNIX_EPOCH"))?;
let mut state = try!(serializer.serialize_struct("SystemTime", 2));
try!(state.serialize_field("secs_since_epoch", &duration_since_epoch.as_secs()));
try!(state.serialize_field("nanos_since_epoch", &duration_since_epoch.subsec_nanos()));
