@@ -116,8 +116,8 @@ func PBToChallenge(in *corepb.Challenge) (challenge core.Challenge, err error) {
116116 return core.Challenge {}, err
117117 }
118118 var validated * time.Time
119- if in .ValidatedNS != 0 {
120- val := time . Unix ( 0 , in .ValidatedNS ). UTC ()
119+ if in .Validated != nil && ! in . Validated . AsTime (). IsZero () {
120+ val := in .Validated . AsTime ()
121121 validated = & val
122122 }
123123 ch := core.Challenge {
@@ -275,8 +275,8 @@ func PbToRegistration(pb *corepb.Registration) (core.Registration, error) {
275275 return core.Registration {}, err
276276 }
277277 var createdAt * time.Time
278- if pb .CreatedAtNS != 0 {
279- c := time . Unix ( 0 , pb .CreatedAtNS ). UTC ()
278+ if pb .CreatedAt != nil && ! pb . CreatedAt . AsTime (). IsZero () {
279+ c := pb .CreatedAt . AsTime ()
280280 createdAt = & c
281281 }
282282 var contacts * []string
@@ -344,8 +344,8 @@ func PBToAuthz(pb *corepb.Authorization) (core.Authorization, error) {
344344 challs [i ] = chall
345345 }
346346 var expires * time.Time
347- if pb .ExpiresNS != 0 {
348- c := time . Unix ( 0 , pb .ExpiresNS ). UTC ()
347+ if pb .Expires != nil && ! pb . Expires . AsTime (). IsZero () {
348+ c := pb .Expires . AsTime ()
349349 expires = & c
350350 }
351351 authz := core.Authorization {
@@ -396,8 +396,8 @@ func PBToCert(pb *corepb.Certificate) core.Certificate {
396396 Serial : pb .Serial ,
397397 Digest : pb .Digest ,
398398 DER : pb .Der ,
399- Issued : time . Unix ( 0 , pb .IssuedNS ),
400- Expires : time . Unix ( 0 , pb .ExpiresNS ),
399+ Issued : pb .Issued . AsTime ( ),
400+ Expires : pb .Expires . AsTime ( ),
401401 }
402402}
403403
@@ -423,11 +423,11 @@ func PBToCertStatus(pb *corepb.CertificateStatus) core.CertificateStatus {
423423 return core.CertificateStatus {
424424 Serial : pb .Serial ,
425425 Status : core .OCSPStatus (pb .Status ),
426- OCSPLastUpdated : time . Unix ( 0 , pb .OcspLastUpdatedNS ),
427- RevokedDate : time . Unix ( 0 , pb .RevokedDateNS ),
426+ OCSPLastUpdated : pb .OcspLastUpdated . AsTime ( ),
427+ RevokedDate : pb .RevokedDate . AsTime ( ),
428428 RevokedReason : revocation .Reason (pb .RevokedReason ),
429- LastExpirationNagSent : time . Unix ( 0 , pb .LastExpirationNagSentNS ),
430- NotAfter : time . Unix ( 0 , pb .NotAfterNS ),
429+ LastExpirationNagSent : pb .LastExpirationNagSent . AsTime ( ),
430+ NotAfter : pb .NotAfter . AsTime ( ),
431431 IsExpired : pb .IsExpired ,
432432 IssuerNameID : pb .IssuerID ,
433433 }
0 commit comments