1
0
Fork 1
mirror of https://github.com/vbatts/tar-split.git synced 2024-11-16 21:38:38 +00:00

keywords: time keyword 9 postition decimal

Matching with the FreeBSD standard format

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-06-27 13:24:03 -04:00
parent fca9d4b5b6
commit 6adcc98b22
2 changed files with 5 additions and 5 deletions

View file

@ -107,9 +107,9 @@ func TestTimeComparison(t *testing.T) {
// This is the format of time from FreeBSD // This is the format of time from FreeBSD
spec := ` spec := `
/set type=file time=0.000000000 /set type=file time=5.000000000
. type=dir . type=dir
file time=0.000000000 file time=5.000000000
.. ..
` `
@ -118,7 +118,7 @@ func TestTimeComparison(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
// This is what mode we're checking for. Round integer of epoch seconds // This is what mode we're checking for. Round integer of epoch seconds
epoch := time.Unix(0, 0) epoch := time.Unix(5, 0)
if err := os.Chtimes(fh.Name(), epoch, epoch); err != nil { if err := os.Chtimes(fh.Name(), epoch, epoch); err != nil {
t.Fatal(err) t.Fatal(err)
} }

View file

@ -209,9 +209,9 @@ var (
timeKeywordFunc = func(path string, info os.FileInfo) (string, error) { timeKeywordFunc = func(path string, info os.FileInfo) (string, error) {
t := info.ModTime().UnixNano() t := info.ModTime().UnixNano()
if t == 0 { if t == 0 {
return "time=0.0", nil return "time=0.000000000", nil
} }
return fmt.Sprintf("time=%d.%d", (t / 1e9), (t % (t / 1e9))), nil return fmt.Sprintf("time=%d.%9.9d", (t / 1e9), (t % (t / 1e9))), nil
} }
linkKeywordFunc = func(path string, info os.FileInfo) (string, error) { linkKeywordFunc = func(path string, info os.FileInfo) (string, error) {
if info.Mode()&os.ModeSymlink != 0 { if info.Mode()&os.ModeSymlink != 0 {