diff --git a/ct/types.go b/ct/types.go index 883e9db..b366fe4 100644 --- a/ct/types.go +++ b/ct/types.go @@ -6,6 +6,7 @@ import ( "encoding/base64" "encoding/json" "fmt" + "time" ) const ( @@ -289,6 +290,10 @@ type SignedTreeHead struct { LogID SHA256Hash `json:"log_id"` // The SHA256 hash of the log's public key } +func (sth *SignedTreeHead) TimestampTime() time.Time { + return time.Unix(int64(sth.Timestamp/1000), int64(sth.Timestamp%1000)*1_000_000).UTC() +} + // SignedCertificateTimestamp represents the structure returned by the // add-chain and add-pre-chain methods after base64 decoding. (see RFC sections // 3.2 ,4.1 and 4.2)