more stuff

This commit is contained in:
Miek Gieben 2012-09-11 22:00:19 +02:00
parent f7f4aa7886
commit 1751b8d753
2 changed files with 10 additions and 11 deletions

View File

@ -1398,17 +1398,6 @@ func StringToTime(s string) (uint32, error) {
return uint32(t.Unix() - (mod * year68)), nil
}
// TimeToUint32 translates a time.Time to a 32 bit value which
// can be used as the RRSIG's inception or expiration times.
func TimeToUint32(t time.Time) uint32 {
// TODO(mg): rfc1982
mod := (t.Unix() / year68) - 1
if mod < 0 {
mod = 0
}
return uint32(t.Unix() - (mod * year68))
}
// saltString converts a NSECX salt to uppercase and
// returns "-" when it is empty
func saltString(s string) string {

10
zone.go
View File

@ -369,3 +369,13 @@ type uint16Slice []uint16
func (p uint16Slice) Len() int { return len(p) }
func (p uint16Slice) Less(i, j int) bool { return p[i] < p[j] }
func (p uint16Slice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
// TimeToUint32 translates a time.Time to a 32 bit value which
// can be used as the RRSIG's inception or expiration times.
func TimeToUint32(t time.Time) uint32 {
mod := (t.Unix() / year68) - 1
if mod < 0 {
mod = 0
}
return uint32(t.Unix() - (mod * year68))
}