diff --git a/print.go b/print.go index 405b37548..a74e3d641 100644 --- a/print.go +++ b/print.go @@ -425,7 +425,7 @@ type Item struct { Creator string `xml:"dc:creator"` } -func (item Item) Print(installTime time.Time) { +func (item Item) Print(buildTime time.Time) { var fd string date, err := time.Parse(time.RFC1123Z, item.PubDate) @@ -433,8 +433,8 @@ func (item Item) Print(installTime time.Time) { fmt.Println(err) } else { fd = formatTime(int(date.Unix())) - if _, double, _ := cmdArgs.getArg("news", "w"); !double && !installTime.IsZero() { - if installTime.After(date) { + if _, double, _ := cmdArgs.getArg("news", "w"); !double && !buildTime.IsZero() { + if buildTime.After(date) { return } } @@ -484,18 +484,18 @@ func printNewsFeed() error { return err } - installTime, err := lastInstallTime() + buildTime, err := lastBuildTime() if err != nil { return err } if config.SortMode == BottomUp { for i := len(rss.Channel.Items) - 1; i >= 0; i-- { - rss.Channel.Items[i].Print(installTime) + rss.Channel.Items[i].Print(buildTime) } } else { for i := 0; i < len(rss.Channel.Items); i++ { - rss.Channel.Items[i].Print(installTime) + rss.Channel.Items[i].Print(buildTime) } } diff --git a/query.go b/query.go index 94ec1994e..d244acd92 100644 --- a/query.go +++ b/query.go @@ -408,22 +408,20 @@ func hangingPackages(removeOptional bool) (hanging []string, err error) { return } -func lastInstallTime() (time.Time, error) { +func lastBuildTime() (time.Time, error) { var time time.Time - localDb, err := alpmHandle.LocalDb() + pkgs, _, _, _, err := filterPackages() if err != nil { return time, err } - localDb.PkgCache().ForEach(func(pkg alpm.Package) error { - thisTime := pkg.InstallDate() + for _, pkg := range pkgs { + thisTime := pkg.BuildDate() if thisTime.After(time) { time = thisTime } - - return nil - }) + } return time, nil }