diff options
| author | Jeff Carr <[email protected]> | 2025-10-12 03:32:26 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-12 03:32:26 -0500 |
| commit | aff745937b2c936f87cc48b82d0725f662bb1e30 (patch) | |
| tree | 374d37a352bb7e90f515db79bf7b41ea316c582b /time.string.go | |
| parent | a32b88646c02fd785687cd2a498b56410e62b2cd (diff) | |
Standard Time(). Perfect place for this. I am pleased.
Diffstat (limited to 'time.string.go')
| -rw-r--r-- | time.string.go | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/time.string.go b/time.string.go new file mode 100644 index 0000000..5dae2c0 --- /dev/null +++ b/time.string.go @@ -0,0 +1,27 @@ +package cobol + +import ( + "errors" + "strconv" + "strings" + "time" +) + +func doTimeString(BUILDTIME string) (time.Time, error) { + var t time.Time + parts := strings.Split(BUILDTIME, ".") + if len(parts) == 1 { + // The input epoch seconds + // epochSeconds := int64(1758646486) + num, err := strconv.Atoi(BUILDTIME) + if err != nil { + return t, err + } + epochSeconds := int64(num) + // Convert the epoch seconds to a time.Time object. + // time.Unix() creates the time in the UTC timezone by default. + t = time.Unix(epochSeconds, 0) + return t, errors.New("treated string as seconds") + } + return t, NewFeature +} |
