Browse Source

Merge pull request #832 from parkerlreed/master

Match the query date/time to pacman. Fixes #831
Anna 6 years ago
parent
commit
3e1f29277b
1 changed files with 8 additions and 2 deletions
  1. 8 2
      print.go

+ 8 - 2
print.go

@@ -227,8 +227,8 @@ func PrintInfo(a *rpc.Pkg) {
 	printInfoValue("Maintainer", a.Maintainer)
 	printInfoValue("Votes", fmt.Sprintf("%d", a.NumVotes))
 	printInfoValue("Popularity", fmt.Sprintf("%f", a.Popularity))
-	printInfoValue("First Submitted", formatTime(a.FirstSubmitted))
-	printInfoValue("Last Modified", formatTime(a.LastModified))
+	printInfoValue("First Submitted", formatTimeQuery(a.FirstSubmitted))
+	printInfoValue("Last Modified", formatTimeQuery(a.LastModified))
 
 	if a.OutOfDate != 0 {
 		printInfoValue("Out-of-date", "Yes ["+formatTime(a.OutOfDate)+"]")
@@ -471,6 +471,12 @@ func formatTime(i int) string {
 	return t.Format("2006-01-02")
 }
 
+// Formats a unix timestamp to ISO 8601 date (Mon 02 Jan 2006 03:04:05 PM MST)
+func formatTimeQuery(i int) string {
+	t := time.Unix(int64(i), 0)
+	return t.Format("Mon 02 Jan 2006 03:04:05 PM MST")
+}
+
 const (
 	redCode     = "\x1b[31m"
 	greenCode   = "\x1b[32m"