mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-06-23 01:04:38 +00:00
652e27e6dd
This commit collects all the time-related fields from the Environment and bundles them all together in their own encapsulated struct.
26 lines
651 B
Rust
26 lines
651 B
Rust
use datetime::TimeZone;
|
|
|
|
use fs::fields as f;
|
|
use output::cell::TextCell;
|
|
use output::colours::Colours;
|
|
use output::time::TimeFormat;
|
|
|
|
|
|
#[allow(trivial_numeric_casts)]
|
|
impl f::Time {
|
|
pub fn render(&self, colours: &Colours,
|
|
tz: &Option<TimeZone>,
|
|
style: &TimeFormat) -> TextCell {
|
|
|
|
if let Some(ref tz) = *tz {
|
|
let datestamp = style.format_zoned(self.0 as i64, tz);
|
|
TextCell::paint(colours.date, datestamp)
|
|
}
|
|
else {
|
|
let datestamp = style.format_local(self.0 as i64);
|
|
TextCell::paint(colours.date, datestamp)
|
|
}
|
|
}
|
|
}
|
|
|