update
All checks were successful
Build and Publish / Metadata (push) Successful in 9s
Build and Publish / BuildAndDeployAmd64 (push) Successful in 1m13s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m26s

This commit is contained in:
matst80
2025-10-16 18:01:32 +02:00
parent 15089862d5
commit c060680768
8 changed files with 263 additions and 181 deletions

View File

@@ -13,7 +13,6 @@ import (
"sort"
"strconv"
"strings"
"syscall"
"time"
"git.tornberg.me/go-cart-actor/pkg/actor"
@@ -54,27 +53,27 @@ func isValidFileId(name string) (uint64, bool) {
return 0, false
}
func AccessTime(info os.FileInfo) (time.Time, bool) {
switch stat := info.Sys().(type) {
case *syscall.Stat_t:
// Linux: Atim; macOS/BSD: Atimespec
// Use reflection or build tags if naming differs.
// Linux:
if stat.Atim.Sec != 0 || stat.Atim.Nsec != 0 {
return time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)), true
}
// macOS/BSD example (uncomment if needed):
// return time.Unix(int64(stat.Atimespec.Sec), int64(stat.Atimespec.Nsec)), true
}
return time.Time{}, false
}
// func AccessTime(info os.FileInfo) (time.Time, bool) {
// switch stat := info.Sys().(type) {
// case *syscall.Stat_t:
// // Linux: Atim; macOS/BSD: Atimespec
// // Use reflection or build tags if naming differs.
// // Linux:
// if stat.Atim.Sec != 0 || stat.Atim.Nsec != 0 {
// return time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)), true
// }
// // macOS/BSD example (uncomment if needed):
// //return time.Unix(int64(stat.Atimespec.Sec), int64(stat.Atimespec.Nsec)), true
// }
// return time.Time{}, false
// }
func appendFileInfo(info fs.FileInfo, out *CartFileInfo) *CartFileInfo {
sys := info.Sys()
fmt.Printf("sys type %T", sys)
out.Size = info.Size()
out.Modified = info.ModTime()
out.Accessed, _ = AccessTime(info)
//out.Accessed, _ = AccessTime(info)
return out
}

View File

@@ -19,7 +19,6 @@ type CartFileInfo struct {
CartId cart.CartId `json:"cartId"`
Size int64 `json:"size"`
Modified time.Time `json:"modified"`
Accessed time.Time `json:"accessed"`
}
func envOrDefault(key, def string) string {