diff --git a/coconut/control/control.go b/coconut/control/control.go index bc0983a8..51b09ff1 100644 --- a/coconut/control/control.go +++ b/coconut/control/control.go @@ -252,7 +252,7 @@ func GetEnvironments(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Com data := make([][]string, 0, 0) for _, envi := range response.GetEnvironments() { - formatted := formatTimestamp(envi.GetCreatedWhen()) + formatted := formatTimestamp(time.Millisecond*time.Duration(envi.GetCreatedWhen())) data = append(data, []string{envi.GetId(), envi.GetRootRole(), formatted, colorState(envi.GetState())}) } @@ -539,7 +539,7 @@ func ShowEnvironment(cxt context.Context, rpc *coconut.RpcClient, cmd *cobra.Com _, _ = fmt.Fprintf(o, "environment id: %s\n", env.GetId()) _, _ = fmt.Fprintf(o, "workflow template: %s\n", env.GetRootRole()) _, _ = fmt.Fprintf(o, "description: %s\n", env.GetDescription()) - _, _ = fmt.Fprintf(o, "created: %s\n", formatTimestamp(env.GetCreatedWhen())) + _, _ = fmt.Fprintf(o, "created: %s\n", formatTimestamp(time.Millisecond*time.Duration(env.GetCreatedWhen()))) _, _ = fmt.Fprintf(o, "state: %s\n", colorState(env.GetState())) if currentTransition := env.GetCurrentTransition(); len(currentTransition) != 0 { _, _ = fmt.Fprintf(o, "transition: %s\n", currentTransition) diff --git a/coconut/control/controlutil.go b/coconut/control/controlutil.go index 7f6642e0..5d85a590 100644 --- a/coconut/control/controlutil.go +++ b/coconut/control/controlutil.go @@ -178,10 +178,9 @@ func drawTableShortTaskInfos(tasks []*pb.ShortTaskInfo, headers []string, linePr table.Render() } -func formatTimestamp(int64timestamp int64) string { - timestamp := time.Unix(0, int64timestamp) - formatted := timestamp.Local().Format("2006-01-02 15:04:05 MST") - return formatted +func formatTimestamp(timestamp time.Duration) string { + time := time.Unix(int64(timestamp.Seconds()), 0) + return time.Local().Format("2006-01-02 15:04:05 MST") } func formatNumber(numberOfMachines int32) string {