2017-07-03 07:45:14 +00:00
|
|
|
use datetime::TimeZone;
|
|
|
|
|
|
|
|
use fs::fields as f;
|
2017-05-22 07:52:45 +00:00
|
|
|
use output::cell::TextCell;
|
|
|
|
use output::colours::Colours;
|
2017-07-03 07:45:14 +00:00
|
|
|
use output::time::TimeFormat;
|
2017-05-22 07:52:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#[allow(trivial_numeric_casts)]
|
|
|
|
impl f::Time {
|
2017-07-03 07:45:14 +00:00
|
|
|
pub fn render(&self, colours: &Colours,
|
|
|
|
tz: &Option<TimeZone>,
|
|
|
|
style: &TimeFormat) -> TextCell {
|
2017-05-22 07:52:45 +00:00
|
|
|
|
|
|
|
if let Some(ref tz) = *tz {
|
2017-07-03 07:45:14 +00:00
|
|
|
let datestamp = style.format_zoned(self.0 as i64, tz);
|
2017-05-22 07:52:45 +00:00
|
|
|
TextCell::paint(colours.date, datestamp)
|
|
|
|
}
|
|
|
|
else {
|
2017-07-03 07:45:14 +00:00
|
|
|
let datestamp = style.format_local(self.0 as i64);
|
2017-05-22 07:52:45 +00:00
|
|
|
TextCell::paint(colours.date, datestamp)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-07-03 07:45:14 +00:00
|
|
|
|