mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Fixing time format string
This commit is contained in:
parent
c4db2f3329
commit
882a6403f8
1 changed files with 4 additions and 6 deletions
10
du/du.rs
10
du/du.rs
|
@ -130,10 +130,8 @@ fn main() {
|
||||||
only if it is N or fewer levels below the command
|
only if it is N or fewer levels below the command
|
||||||
line argument; --max-depth=0 is the same as --summarize", "N"),
|
line argument; --max-depth=0 is the same as --summarize", "N"),
|
||||||
// In main
|
// In main
|
||||||
groups::optflag("", "time", "show time of the last modification of any file in the
|
groups::optflagopt("", "time", "show time of the last modification of any file in the
|
||||||
directory, or any of its subdirectories"),
|
directory, or any of its subdirectories. If WORD is given, show time as WORD instead of modification time:
|
||||||
// In main
|
|
||||||
groups::optopt("", "time", "show time as WORD instead of modification time:
|
|
||||||
atime, access, use, ctime or status", "WORD"),
|
atime, access, use, ctime or status", "WORD"),
|
||||||
// In main
|
// In main
|
||||||
groups::optopt("", "time-style", "show times using style STYLE:
|
groups::optopt("", "time-style", "show times using style STYLE:
|
||||||
|
@ -275,7 +273,7 @@ ers of 1000).");
|
||||||
let time_format_str = match matches.opt_str("time-style") {
|
let time_format_str = match matches.opt_str("time-style") {
|
||||||
Some(s) => {
|
Some(s) => {
|
||||||
match s.as_slice() {
|
match s.as_slice() {
|
||||||
"full-iso" => "%Y-%m-%d %H:%M:%S.%N %z",
|
"full-iso" => "%Y-%m-%d %H:%M:%S.%f %z",
|
||||||
"long-iso" => "%Y-%m-%d %H:%M",
|
"long-iso" => "%Y-%m-%d %H:%M",
|
||||||
"iso" => "%Y-%m-%d",
|
"iso" => "%Y-%m-%d",
|
||||||
_ => {
|
_ => {
|
||||||
|
@ -330,7 +328,7 @@ Try 'du --help' for more information.");
|
||||||
},
|
},
|
||||||
None => stat.modified
|
None => stat.modified
|
||||||
};
|
};
|
||||||
((time / 1000) as i64, (time % 1000 * 1000) as i32)
|
((time / 1000) as i64, (time % 1000 * 1000000) as i32)
|
||||||
};
|
};
|
||||||
let time_spec = Timespec::new(secs, nsecs);
|
let time_spec = Timespec::new(secs, nsecs);
|
||||||
extra::time::at(time_spec).strftime(time_format_str)
|
extra::time::at(time_spec).strftime(time_format_str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue