summaryrefslogtreecommitdiff
path: root/internal/clock/clock.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-29 07:50:31 +0300
committerPaul Buetow <paul@buetow.org>2026-04-29 07:50:31 +0300
commitaa95230758cd3487b5d4c55015c502c0f37e1760 (patch)
tree1cc18359b7753554cbf43dcf422641a4cee90414 /internal/clock/clock.go
parent2de97cd74935b5215d2266a4ae0e06b34aa31a98 (diff)
feat: implement bcrypt password hashing, session management, login/logout handlers, and bootstrap flow (m9)
Diffstat (limited to 'internal/clock/clock.go')
-rw-r--r--internal/clock/clock.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/internal/clock/clock.go b/internal/clock/clock.go
index def1ebb..8809109 100644
--- a/internal/clock/clock.go
+++ b/internal/clock/clock.go
@@ -1,2 +1,28 @@
// Package clock abstracts time for testability.
package clock
+
+import "time"
+
+// Clock provides the current time.
+type Clock interface {
+ Now() time.Time
+}
+
+// RealClock uses the system clock.
+type RealClock struct{}
+
+// Now returns the current time.
+func (RealClock) Now() time.Time { return time.Now() }
+
+// MockClock is a fake clock for testing.
+type MockClock struct {
+ T time.Time
+}
+
+// Now returns the mock time.
+func (m *MockClock) Now() time.Time { return m.T }
+
+var (
+ _ Clock = (*RealClock)(nil)
+ _ Clock = (*MockClock)(nil)
+)