package cli import ( "time" "sneak.berlin/go/mfer/mfer" ) // mtimeAbsent is printed in place of a modification time when a manifest // entry does not carry one. const mtimeAbsent = "-" // entryMtime returns the modification time recorded for a manifest entry. // // MFFilePath.Mtime is a message pointer with proto3 field presence, so an // absent mtime is a representable, on-the-wire-valid state. It must never // be conflated with a recorded mtime of the Unix epoch: callers that // compare mtimes have to treat "absent" as "unknown", not as // 1970-01-01T00:00:00Z, or every entry compares as modified. ok reports // whether an mtime was actually recorded. func entryMtime(entry *mfer.MFFilePath) (time.Time, bool) { ts := entry.GetMtime() if ts == nil { return time.Time{}, false } return time.Unix(ts.GetSeconds(), int64(ts.GetNanos())), true }