mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
refactor(coderd/database): split Time and Now into dbtime package (#9482)
Ref: #9380
This commit is contained in:
@@ -79,14 +79,3 @@ func (m *StringMap) Scan(src interface{}) error {
|
||||
func (m StringMap) Value() (driver.Value, error) {
|
||||
return json.Marshal(m)
|
||||
}
|
||||
|
||||
// Now returns a standardized timezone used for database resources.
|
||||
func Now() time.Time {
|
||||
return Time(time.Now().UTC())
|
||||
}
|
||||
|
||||
// Time returns a time compatible with Postgres. Postgres only stores dates with
|
||||
// microsecond precision.
|
||||
func Time(t time.Time) time.Time {
|
||||
return t.Round(time.Microsecond)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user