blob: 5dae2c0fbda824cf7740a19216c3450c66907543 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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
}
|