Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB: Truncate timestamps to microseconds #7075

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions sa/type-converter.go
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"
"time"

"github.com/letsencrypt/borp"
"gopkg.in/go-jose/go-jose.v2"
Expand Down Expand Up @@ -34,6 +35,10 @@ func (tc BoulderTypeConverter) ToDb(val interface{}) (interface{}, error) {
return string(t), nil
case core.OCSPStatus:
return string(t), nil
case time.Time:
// All of our MySQL DATETIME columns have only Second-level precision, so
// don't bother sending more precision than the database will use.
return t.Truncate(time.Second), nil
default:
return val, nil
}
Expand Down