AccessTime helper moved to missinggo

This commit is contained in:
Matt Joiner 2015-06-01 18:26:32 +10:00
parent 5b52769523
commit 665e3c72fc
3 changed files with 3 additions and 25 deletions

View File

@ -1,12 +0,0 @@
package blob
import (
"os"
"syscall"
"time"
)
func accessTime(fi os.FileInfo) time.Time {
ts := fi.Sys().(*syscall.Stat_t).Atimespec
return time.Unix(ts.Sec, ts.Nano())
}

View File

@ -1,12 +0,0 @@
package blob
import (
"os"
"syscall"
"time"
)
func accessTime(fi os.FileInfo) time.Time {
ts := fi.Sys().(*syscall.Stat_t).Atim
return time.Unix(ts.Sec, ts.Nano())
}

View File

@ -13,6 +13,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/anacrolix/missinggo"
dataPkg "github.com/anacrolix/torrent/data" dataPkg "github.com/anacrolix/torrent/data"
"github.com/anacrolix/torrent/metainfo" "github.com/anacrolix/torrent/metainfo"
) )
@ -186,7 +188,7 @@ func (me fileInfoSorter) Len() int {
func lastTime(fi os.FileInfo) (ret time.Time) { func lastTime(fi os.FileInfo) (ret time.Time) {
ret = fi.ModTime() ret = fi.ModTime()
atime := accessTime(fi) atime := missinggo.FileInfoAccessTime(fi)
if atime.After(ret) { if atime.After(ret) {
ret = atime ret = atime
} }