Skip to content

Commit

Permalink
Make time handling in OCI platform independent
Browse files Browse the repository at this point in the history
  • Loading branch information
liamfallon committed Nov 27, 2024
1 parent a76a87f commit 6eabec1
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions test/ociserver/pkg/oci/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"path/filepath"
"strconv"
"strings"
"syscall"
"time"

"github.com/google/uuid"
Expand Down Expand Up @@ -284,21 +283,15 @@ func (r *Registry) ListTags(ctx context.Context) (*Tags, error) {
if err != nil {
return nil, fmt.Errorf("error reading %q: %w", p, err)
}
stat, err := os.Stat(p)
if err != nil {
return nil, fmt.Errorf("error from os.Stat(%q): %w", p, err)
}
unixStat := stat.Sys().(*syscall.Stat_t)

hash := sha256.Sum256(b)
ref := "sha256:" + hex.EncodeToString(hash[:])
existing, found := tags.Manifests[ref]
if !found {
existing = ManifestInfo{}
ctime := time.Unix(int64(unixStat.Ctim.Sec), int64(unixStat.Ctim.Nsec))
// TODO: What should these values really be?
existing.TimeCreatedMs = strconv.FormatInt(ctime.UnixMilli(), 10)
existing.TimeUploadedMS = strconv.FormatInt(ctime.UnixMilli(), 10)
existing.TimeCreatedMs = strconv.FormatInt(time.Now().Unix(), 10)
existing.TimeUploadedMS = strconv.FormatInt(time.Now().UnixMilli(), 10)
// TODO: ImageSizeBytes
// TODO: MediaType
}
Expand Down

0 comments on commit 6eabec1

Please sign in to comment.