From dd647db5acdae79ee3d5f0ca06f1d05c243d2b56 Mon Sep 17 00:00:00 2001 From: hurf Date: Mon, 10 Aug 2015 15:00:24 +0800 Subject: [PATCH] Print human readable time for event Reduce the length of event time as AGE column does. --- pkg/kubectl/describe.go | 4 ++-- pkg/kubectl/resource_printer.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/kubectl/describe.go b/pkg/kubectl/describe.go index 083bd45dbb8..5cf2c1f8f80 100644 --- a/pkg/kubectl/describe.go +++ b/pkg/kubectl/describe.go @@ -898,8 +898,8 @@ func DescribeEvents(el *api.EventList, w io.Writer) { fmt.Fprint(w, "Events:\n FirstSeen\tLastSeen\tCount\tFrom\tSubobjectPath\tReason\tMessage\n") for _, e := range el.Items { fmt.Fprintf(w, " %s\t%s\t%d\t%v\t%v\t%v\t%v\n", - e.FirstTimestamp.Time.Format(time.RFC1123Z), - e.LastTimestamp.Time.Format(time.RFC1123Z), + translateTimestamp(e.FirstTimestamp), + translateTimestamp(e.LastTimestamp), e.Count, e.Source, e.InvolvedObject.FieldPath, diff --git a/pkg/kubectl/resource_printer.go b/pkg/kubectl/resource_printer.go index 0421a872f78..4069f55d91d 100644 --- a/pkg/kubectl/resource_printer.go +++ b/pkg/kubectl/resource_printer.go @@ -850,8 +850,8 @@ func printEvent(event *api.Event, w io.Writer, withNamespace bool, wide bool, co } if _, err := fmt.Fprintf( w, "%s\t%s\t%d\t%s\t%s\t%s\t%s\t%s\t%s", - event.FirstTimestamp.Time.Format(time.RFC1123Z), - event.LastTimestamp.Time.Format(time.RFC1123Z), + translateTimestamp(event.FirstTimestamp), + translateTimestamp(event.LastTimestamp), event.Count, event.InvolvedObject.Name, event.InvolvedObject.Kind,