diff options
author | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-02-19 19:24:34 +0000 |
---|---|---|
committer | boasting-squirrel <boasting.squirrel@gmail.com> | 2019-02-19 19:24:34 +0000 |
commit | c14072c349b7a57034a0aba288408ac06d803478 (patch) | |
tree | 74a56b0952b300da820fd34b189ea1557a50e0c2 | |
parent | Improved code (diff) | |
download | miniserve-c14072c349b7a57034a0aba288408ac06d803478.tar.gz miniserve-c14072c349b7a57034a0aba288408ac06d803478.zip |
Renamed humanize_duration to humanize_systemtime
-rw-r--r-- | src/listing.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/listing.rs b/src/listing.rs index 9203f48..21aebec 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -198,7 +198,7 @@ pub fn directory_listing<S>( let _ = write!( body, "<tr><td><a class=\"directory\" href=\"{}\">{}/</a></td><td></td><td class=\"date-cell\"><span>{}</span><span>{}</span><span>{}</span></td></tr>", - entry.link, entry.name, modification_date, modification_time, humanize_duration(entry.last_modification_date) + entry.link, entry.name, modification_date, modification_time, humanize_systemtime(entry.last_modification_date) ); } EntryType::File => { @@ -210,7 +210,7 @@ pub fn directory_listing<S>( entry.size.unwrap(), modification_date, modification_time, - humanize_duration(entry.last_modification_date) + humanize_systemtime(entry.last_modification_date) ); } } @@ -329,7 +329,7 @@ fn convert_to_utc(src_time: Option<SystemTime>) -> (String, String) { /// and gives a rough approximation of the elapsed time since /// /// If no SystemTime was given, returns an empty string -fn humanize_duration(src_time: Option<SystemTime>) -> String { +fn humanize_systemtime(src_time: Option<SystemTime>) -> String { src_time .and_then(|std_time| SystemTime::now().duration_since(std_time).ok()) .and_then(|from_now| Duration::from_std(from_now).ok()) |