| @@ -1,4 +1,4 @@ | ||||
| use std::fmt::{self, Show}; | ||||
| use std::fmt; | ||||
| use std::str::FromStr; | ||||
| use time::Tm; | ||||
| use header::{Header, HeaderFormat}; | ||||
| @@ -7,7 +7,7 @@ use header::shared::time::tm_from_str; | ||||
|  | ||||
| // Egh, replace as soon as something better than time::Tm exists. | ||||
| /// The `Date` header field. | ||||
| #[derive(Copy, PartialEq, Clone)] | ||||
| #[derive(Copy, PartialEq, Clone, Show)] | ||||
| pub struct Date(pub Tm); | ||||
|  | ||||
| deref!(Date => Tm); | ||||
| @@ -25,11 +25,12 @@ impl Header for Date { | ||||
|  | ||||
| impl HeaderFormat for Date { | ||||
|     fn fmt_header(&self, fmt: &mut fmt::Formatter) -> fmt::Result { | ||||
|         let tm = **self; | ||||
|         match tm.tm_utcoff { | ||||
|             0 => tm.rfc822().fmt(fmt), | ||||
|             _ => tm.to_utc().rfc822().fmt(fmt) | ||||
|         } | ||||
|         let tm = self.0; | ||||
|         let tm = match tm.tm_utcoff { | ||||
|             0 => tm, | ||||
|             _ => tm.to_utc(), | ||||
|         }; | ||||
|         fmt::String::fmt(&tm.rfc822(), fmt) | ||||
|     } | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user