Initial windows runtime work
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/containerd/containerd/log"
|
||||
@@ -156,19 +155,12 @@ func (s *Store) status(ingestPath string) (Status, error) {
|
||||
return Status{}, err
|
||||
}
|
||||
|
||||
var startedAt time.Time
|
||||
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
|
||||
startedAt = time.Unix(int64(st.Ctim.Sec), int64(st.Ctim.Nsec))
|
||||
} else {
|
||||
startedAt = fi.ModTime()
|
||||
}
|
||||
|
||||
return Status{
|
||||
Ref: ref,
|
||||
Offset: fi.Size(),
|
||||
Total: s.total(ingestPath),
|
||||
UpdatedAt: fi.ModTime(),
|
||||
StartedAt: startedAt,
|
||||
StartedAt: getStartTime(fi),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
17
content/store_unix.go
Normal file
17
content/store_unix.go
Normal file
@@ -0,0 +1,17 @@
|
||||
// +build linux
|
||||
|
||||
package content
|
||||
|
||||
import (
|
||||
"os"
|
||||
"syscall"
|
||||
"time"
|
||||
)
|
||||
|
||||
func getStartTime(fi os.FileInfo) time.Time {
|
||||
if st, ok := fi.Sys().(*syscall.Stat_t); ok {
|
||||
return time.Unix(st.Ctim.Sec, st.Ctim.Nsec)
|
||||
}
|
||||
|
||||
return fi.ModTime()
|
||||
}
|
10
content/store_windows.go
Normal file
10
content/store_windows.go
Normal file
@@ -0,0 +1,10 @@
|
||||
package content
|
||||
|
||||
import (
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
func getStartTime(fi os.FileInfo) time.Time {
|
||||
return fi.ModTime()
|
||||
}
|
Reference in New Issue
Block a user