Add TimestampTime() to ct.SignedTreeHead
This commit is contained in:
parent
9b29ca93b8
commit
fe4ef6b05d
|
@ -6,6 +6,7 @@ import (
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -289,6 +290,10 @@ type SignedTreeHead struct {
|
||||||
LogID SHA256Hash `json:"log_id"` // The SHA256 hash of the log's public key
|
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
|
// SignedCertificateTimestamp represents the structure returned by the
|
||||||
// add-chain and add-pre-chain methods after base64 decoding. (see RFC sections
|
// add-chain and add-pre-chain methods after base64 decoding. (see RFC sections
|
||||||
// 3.2 ,4.1 and 4.2)
|
// 3.2 ,4.1 and 4.2)
|
||||||
|
|
Loading…
Reference in New Issue