]> go.fuhry.dev Git - runtime.git/commitdiff
[constants] add BuildTimestampTime main
authorDan Fuhry <dan@fuhry.com>
Wed, 3 Jun 2026 04:52:53 +0000 (00:52 -0400)
committerDan Fuhry <dan@fuhry.com>
Wed, 3 Jun 2026 04:52:53 +0000 (00:52 -0400)
constants/BUILD.bazel
constants/helpers.go [new file with mode: 0644]

index b9a36a71c0b5ec3b209f3881c7ac4a993c9d230c..e61ae48e08933304acb3578e5b251a24f4bcb8c2 100644 (file)
@@ -15,7 +15,10 @@ genrule(
 
 go_multi_library(
     name = "constants",
 
 go_multi_library(
     name = "constants",
-    srcs = ["constants.go"],
+    srcs = [
+        "constants.go",
+        "helpers.go",
+    ],
     importpath = "go.fuhry.dev/runtime/constants",
     visibility = ["//visibility:public"],
 )
     importpath = "go.fuhry.dev/runtime/constants",
     visibility = ["//visibility:public"],
 )
diff --git a/constants/helpers.go b/constants/helpers.go
new file mode 100644 (file)
index 0000000..0ecb003
--- /dev/null
@@ -0,0 +1,14 @@
+package constants
+
+import (
+       "strconv"
+       "time"
+)
+
+func BuildTimestampTime() time.Time {
+       ts, err := strconv.ParseInt(BuildTimestamp, 10, 64)
+       if err != nil {
+               panic(err)
+       }
+       return time.Unix(ts, 0)
+}