Skip to content

Commit

Permalink
Merge pull request #147 from Nordix/time-plat-ind
Browse files Browse the repository at this point in the history
Make time handling in OCI platform independent
  • Loading branch information
nephio-prow[bot] authored Dec 3, 2024
2 parents de90105 + 6eabec1 commit 25ec6d3
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 25ec6d3

Please sign in to comment.