init: 1.0.0

This commit is contained in:
Chang lue Tsen
2025-04-25 12:08:29 +09:00
commit 8addcc584b
1031 changed files with 76472 additions and 0 deletions
+17
View File
@@ -0,0 +1,17 @@
package timex
import "time"
// Use the long enough past time as start time, in case timex.Now() - lastTime equals 0.
var initTime = time.Now().AddDate(-1, -1, -1)
// Now returns a relative time duration since initTime, which is not important.
// The caller only needs to care about the relative value.
func Now() time.Duration {
return time.Since(initTime)
}
// Since returns a diff since given d.
func Since(d time.Duration) time.Duration {
return time.Since(initTime) - d
}