From aba84efbf84d61a538e8c1e34834cd604f81372c Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 19 Oct 2025 12:56:33 -0500 Subject: more cases handled --- dumbTable.go | 4 ++-- time.go | 6 ++++++ time.string.go | 6 ++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dumbTable.go b/dumbTable.go index 66e5328..bce0b91 100644 --- a/dumbTable.go +++ b/dumbTable.go @@ -47,7 +47,7 @@ func DumbTable3(lines []string) { parts := strings.Fields(line) if len(parts) != 3 { log.Info(parts) - panic("not 3 things") + // panic("not 3 things") continue } if size1 < len(parts[0]) { @@ -65,7 +65,7 @@ func DumbTable3(lines []string) { parts := strings.Fields(line) if len(parts) != 3 { log.Info(parts) - panic("not 3 things") + // panic("not 3 things") continue } line, fmtline := StandardTableRow(sizes, parts) diff --git a/time.go b/time.go index df89d24..ca38233 100644 --- a/time.go +++ b/time.go @@ -64,6 +64,10 @@ func TimeCheck(maybeTime any) (string, *time.Time, error) { // If the type is time.Time, 'v' is now a time.Time variable. // t = v return FormatTime(v), &v, err + case *time.Time: + // If the type is time.Time, 'v' is now a time.Time variable. + // t = v + return FormatTime(*v), v, err case string: // The type is string, so 'v' is a string variable. t, err = doTimeString(v) @@ -90,6 +94,8 @@ func TimeCheck(maybeTime any) (string, *time.Time, error) { newt := v.AsTime() return FormatTime(newt), &newt, nil } + case nil: + err = errors.New("TimeCheck got nil") default: err = errors.Join(err, NoTime) } diff --git a/time.string.go b/time.string.go index 22f667d..5d15abe 100644 --- a/time.string.go +++ b/time.string.go @@ -49,5 +49,11 @@ func doTimeString(BUILDTIME string) (*time.Time, error) { } } + // try lots of common stuff + const layout = "2025-10-19 11:47:48 -0500 CDT" + t, err := time.ParseInLocation(layout, parts[0]+" "+parts[1], time.UTC) + if err == nil { + return &t, nil + } return nil, NewFeature } -- cgit v1.2.3