@@ -63,7 +63,7 @@ pub struct Cli {
6363 colors_on : bool ,
6464
6565 /// Specify time format https://docs.rs/chrono/*/chrono/format/strftime/index.html
66- #[ structopt( long = "time-format" , default_value = "%b %e %T" ) ]
66+ #[ structopt( long = "time-format" , default_value = "%e %b %T" ) ]
6767 time_format : String ,
6868
6969 /// Turns off sorting by name (on by default)
@@ -159,8 +159,8 @@ fn output() -> Result<(), Box<dyn std::error::Error>> {
159159 let mut size_count = 4 ;
160160 let mut group_size = 8 ;
161161 for s in & entries {
162- if convert ( fs:: symlink_metadata ( & s) ?. size ( ) as f64 ) . len ( ) > size_count {
163- size_count = convert ( fs:: symlink_metadata ( & s) ?. size ( ) as f64 ) . len ( ) ;
162+ if ( fs:: symlink_metadata ( & s) ?. size ( ) ) . file_size ( options :: CONVENTIONAL ) . unwrap ( ) . len ( ) > size_count {
163+ size_count = ( fs:: symlink_metadata ( & s) ?. size ( ) ) . file_size ( options :: CONVENTIONAL ) . unwrap ( ) . len ( ) ;
164164 } ;
165165
166166 let metadata_uid = fs:: symlink_metadata ( & s) ?. uid ( ) ;
@@ -255,12 +255,8 @@ pub fn file_size(
255255 size_count : usize ,
256256 e : & & std:: path:: PathBuf ,
257257) -> Result < ( ) , Box < dyn std:: error:: Error > > {
258- if size_count > 4 {
259- for _ in 0 ..( size_count
260- - ( fs:: symlink_metadata ( & e) ?. size ( ) )
261- . file_size ( options:: CONVENTIONAL )
262- . unwrap ( )
263- . len ( ) )
258+ if ( fs:: symlink_metadata ( & e) ?. size ( ) ) . file_size ( options:: CONVENTIONAL ) . unwrap ( ) . len ( ) < size_count {
259+ for _ in 0 ..( size_count - ( fs:: symlink_metadata ( & e) ?. size ( ) ) . file_size ( options:: CONVENTIONAL ) . unwrap ( ) . len ( ) )
264260 {
265261 print ! ( " " ) ;
266262 }
@@ -289,6 +285,14 @@ pub fn time_mod(
289285 FileTime :: from_last_modification_time ( & timestamp) . seconds ( ) as i64 ,
290286 0 ,
291287 ) ;
288+ //let now = Utc::now();
289+ //let back = NaiveDateTime::from_timestamp(FileTime::from_last_modification_time(×tamp).seconds() as i64, 0);
290+ //let d: DateTime<Utc> = DateTime::from_utc(back, Utc);
291+ //let rel = now.signed_duration_since(d).num_seconds();
292+ //println!("{}", chrono::Duration::seconds(rel).num_seconds());
293+ //println!("{}", chrono::Duration::seconds(rel).num_hours());
294+ //println!("{}", chrono::Duration::seconds(rel).num_days());
295+ //println!("{}", chrono::Duration::seconds(rel).num_weeks());
292296 let datetime: DateTime < Local > = DateTime :: from_utc ( naive, * Local :: now ( ) . offset ( ) ) ;
293297 if !Cli :: from_args ( ) . colors_on {
294298 print ! ( "{}" , color:: Fg ( color:: LightRed ) ) ;
0 commit comments