From 6eabec179f012c1561d97a7e7181b1b79b36fe60 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 27 Nov 2024 16:40:18 +0000 Subject: [PATCH] Make time handling in OCI platform independent --- test/ociserver/pkg/oci/registry.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/ociserver/pkg/oci/registry.go b/test/ociserver/pkg/oci/registry.go index f3922c84..21a84e7b 100644 --- a/test/ociserver/pkg/oci/registry.go +++ b/test/ociserver/pkg/oci/registry.go @@ -25,7 +25,6 @@ import ( "path/filepath" "strconv" "strings" - "syscall" "time" "github.com/google/uuid" @@ -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 }