parent
c629b3d4ce
commit
ce5c5845e7
15
ui.go
15
ui.go
@ -262,6 +262,15 @@ func (win *win) printReg(screen tcell.Screen, reg *reg) {
|
||||
}
|
||||
}
|
||||
|
||||
var gThisYear = time.Now().Year()
|
||||
|
||||
func infotimefmt(t time.Time) string {
|
||||
if t.Year() == gThisYear {
|
||||
return t.Format("Jan _2 15:04")
|
||||
}
|
||||
return t.Format("Jan _2 2006")
|
||||
}
|
||||
|
||||
func fileInfo(f *file, d *dir) string {
|
||||
var info string
|
||||
|
||||
@ -300,11 +309,11 @@ func fileInfo(f *file, d *dir) string {
|
||||
info = fmt.Sprintf("%s 999+", info)
|
||||
}
|
||||
case "time":
|
||||
info = fmt.Sprintf("%s %12s", info, f.ModTime().Format("Jan _2 15:04"))
|
||||
info = fmt.Sprintf("%s %12s", info, infotimefmt(f.ModTime()))
|
||||
case "atime":
|
||||
info = fmt.Sprintf("%s %12s", info, f.accessTime.Format("Jan _2 15:04"))
|
||||
info = fmt.Sprintf("%s %12s", info, infotimefmt(f.accessTime))
|
||||
case "ctime":
|
||||
info = fmt.Sprintf("%s %12s", info, f.changeTime.Format("Jan _2 15:04"))
|
||||
info = fmt.Sprintf("%s %12s", info, infotimefmt(f.changeTime))
|
||||
default:
|
||||
log.Printf("unknown info type: %s", s)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user