From 5b08f8b4a007645b8e5bd476ee016b97462e1242 Mon Sep 17 00:00:00 2001 From: Susana Ferreira Date: Wed, 20 Aug 2025 14:58:00 +0100 Subject: [PATCH] fix: change createWorkspace to use dbtime.Time (#19414) The `createWorkspace` function was updated to use an injected Clock, which makes it possible to mock time in tests: https://github.com/coder/coder/pull/19264/files#diff-46f90baab52ea3ad914acbde30d656dbc8e46f5918d19bc056c445a1dc502482R1130 For database operations, however, it is recommended to use `dbtime.Time` since it rounds to the microsecond, the smallest unit of precision supported by Postgres. --- coderd/workspaces.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coderd/workspaces.go b/coderd/workspaces.go index b2b2610ff1..e998aeb894 100644 --- a/coderd/workspaces.go +++ b/coderd/workspaces.go @@ -636,7 +636,7 @@ func createWorkspace( ) // Use injected Clock to allow time mocking in tests - now := api.Clock.Now() + now := dbtime.Time(api.Clock.Now()) templateVersionPresetID := req.TemplateVersionPresetID