You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
is populated correctly with nano timestamps in sqlite3 but in mysql values are rounded to ms i.e. you get 1689751262515000000 instead of 1689751262515828345 in mysql column.
&gorm.Config{
NowFunc: func() time.Time {
return time.Now() // Here we use monotonic clock to avoid clock synchronization diffs see https://pkg.go.dev/time#hdr-Monotonic_Clocks
},
})
Adding ;precision:9 nor ;precision=9field tag to ModTime column definition as above does not work.
Datetime precision logic should not be used probably for autoCreateTime nor autoUpdateTime columns because it defines time resolution on its own.
The text was updated successfully, but these errors were encountered:
Description
Column defined with
is populated correctly with nano timestamps in sqlite3 but in mysql values are rounded to ms i.e. you get
1689751262515000000
instead of1689751262515828345
in mysql column.Workaround that works for us is to set
datetimePrecision = 9
or forceNowFunc
i.e.Adding
;precision:9
nor;precision=9
field tag toModTime
column definition as above does not work.Datetime precision logic should not be used probably for
autoCreateTime
norautoUpdateTime
columns because it defines time resolution on its own.The text was updated successfully, but these errors were encountered: