use std::io::IoResult instead of std::fmt::Result
simplify by using try!
avoid some unnecessary locals
remove unused import
adds parsing of headers that contain dates

not fully tested, but functional
move macros up a level; they're not specific to date headers