@@ -229,14 +229,18 @@ func RegistrationToPB(reg core.Registration) (*corepb.Registration, error) {
229229 if reg .Contact != nil {
230230 contacts = * reg .Contact
231231 }
232+ var createdAt int64
233+ if reg .CreatedAt != nil {
234+ createdAt = reg .CreatedAt .UTC ().UnixNano ()
235+ }
232236 return & corepb.Registration {
233237 Id : reg .ID ,
234238 Key : keyBytes ,
235239 Contact : contacts ,
236240 ContactsPresent : contactsPresent ,
237241 Agreement : reg .Agreement ,
238242 InitialIP : ipBytes ,
239- CreatedAt : reg . CreatedAt . UnixNano () ,
243+ CreatedAt : createdAt ,
240244 Status : string (reg .Status ),
241245 }, nil
242246}
@@ -252,6 +256,11 @@ func PbToRegistration(pb *corepb.Registration) (core.Registration, error) {
252256 if err != nil {
253257 return core.Registration {}, err
254258 }
259+ var createdAt * time.Time
260+ if pb .CreatedAt != 0 {
261+ c := time .Unix (0 , pb .CreatedAt ).UTC ()
262+ createdAt = & c
263+ }
255264 var contacts * []string
256265 if pb .ContactsPresent {
257266 if len (pb .Contact ) != 0 {
@@ -272,7 +281,7 @@ func PbToRegistration(pb *corepb.Registration) (core.Registration, error) {
272281 Contact : contacts ,
273282 Agreement : pb .Agreement ,
274283 InitialIP : initialIP ,
275- CreatedAt : time . Unix ( 0 , pb . CreatedAt ) ,
284+ CreatedAt : createdAt ,
276285 Status : core .AcmeStatus (pb .Status ),
277286 }, nil
278287}
@@ -322,7 +331,7 @@ func PBToAuthz(pb *corepb.Authorization) (core.Authorization, error) {
322331}
323332
324333func newRegistrationValid (reg * corepb.Registration ) bool {
325- return ! (len (reg .Key ) == 0 || len (reg .InitialIP ) == 0 || reg . CreatedAt == 0 )
334+ return ! (len (reg .Key ) == 0 || len (reg .InitialIP ) == 0 )
326335}
327336
328337func registrationValid (reg * corepb.Registration ) bool {
0 commit comments