diff options
| author | Jeff Carr <[email protected]> | 2025-10-19 12:56:33 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-19 12:56:33 -0500 |
| commit | aba84efbf84d61a538e8c1e34834cd604f81372c (patch) | |
| tree | 9400d43f0814e33a57c050e42c6b099e0f13ac60 | |
| parent | 4a74e4af615b6f264c795cb664c55359f588c7c0 (diff) | |
more cases handledv0.0.27
| -rw-r--r-- | dumbTable.go | 4 | ||||
| -rw-r--r-- | time.go | 6 | ||||
| -rw-r--r-- | 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) @@ -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 } |
