exa/src/output/render/times.rs

26 lines
651 B
Rust
Raw Normal View History

use datetime::TimeZone;
use fs::fields as f;
2017-05-22 07:52:45 +00:00
use output::cell::TextCell;
use output::colours::Colours;
use output::time::TimeFormat;
2017-05-22 07:52:45 +00:00
#[allow(trivial_numeric_casts)]
impl f::Time {
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 {
let datestamp = style.format_zoned(self.0 as i64, tz);
2017-05-22 07:52:45 +00:00
TextCell::paint(colours.date, datestamp)
}
else {
let datestamp = style.format_local(self.0 as i64);
2017-05-22 07:52:45 +00:00
TextCell::paint(colours.date, datestamp)
}
}
}