package output import ( "fmt" "time" ) // unixToTime converts a Unix-second timestamp to time.Time. // Returns (time, true) for ts > 0; (zero, false) for unset/zero values. func unixToTime(ts int64) (time.Time, bool) { if ts <= 0 { return time.Time{}, false } return time.Unix(ts, 0), true } // fmtUnixTime formats a Unix timestamp as "Jan 02 15:04" for table display. // Returns "-" for zero/unset values. func fmtUnixTime(ts int64) string { t, ok := unixToTime(ts) if !ok { return "-" } return formatJobTime(t) } // formatJobTime formats a time.Time as "Jan 02 15:04" for table display. func formatJobTime(t time.Time) string { return fmt.Sprintf("%s %02d %02d:%02d", t.Format("Jan"), t.Day(), t.Hour(), t.Minute()) }