keywords: accurate nanoseconds for time=

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
Vincent Batts 2016-03-18 09:42:16 -04:00
parent d1ddeb8e3d
commit ef9ba54f10

View file

@ -8,7 +8,6 @@ import (
"fmt" "fmt"
"hash" "hash"
"io" "io"
"math"
"os" "os"
"golang.org/x/crypto/ripemd160" "golang.org/x/crypto/ripemd160"
@ -113,9 +112,8 @@ var (
} }
} }
timeKeywordFunc = func(path string, info os.FileInfo) (string, error) { timeKeywordFunc = func(path string, info os.FileInfo) (string, error) {
t := info.ModTime() t := info.ModTime().UnixNano()
n := float64(t.UnixNano()) / math.Pow10(9) return fmt.Sprintf("time=%d.%d", (t / 1e9), (t % (t / 1e9))), nil
return fmt.Sprintf("time=%0.9f", n), 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 {