From 88ca40bcfa11f464828cace14a07a9b59a00d571 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 16 Feb 2024 01:22:37 -0600 Subject: tag date format things --- unix.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'unix.go') diff --git a/unix.go b/unix.go index 7e295e8..b1fcff7 100644 --- a/unix.go +++ b/unix.go @@ -274,7 +274,19 @@ func readFileToString(filename string) (string, error) { return strings.TrimSpace(string(data)), nil } -func getDateStamp(raw string) (time.Time, string, string) { +// converts a git for-each-ref date. "Wed Feb 7 10:13:38 2024 -0600" +func getGitDateStamp(gitdefault string) (time.Time, string, string) { + // now := time.Now().Format("Wed Feb 7 10:13:38 2024 -0600") + const gitLayout = "Mon Jan 2 15:04:05 2006 -0700" + tagTime, err := time.Parse(gitLayout, gitdefault) + if err != nil { + log.Warn("GOT THIS IN PARSE AAA."+gitdefault+".AAA") + log.Warn(err) + return time.Now(), "Feb 1 12:34:56 1978 -0600", "" + } + return tagTime, gitdefault, getDurationStamp(tagTime) +} +func getRawDateStamp(raw string) (time.Time, string, string) { parts := strings.Split(raw, " ") if len(parts) == 0 { // raw was blank here -- cgit v1.2.3