From 10c0672a9910bbcba9c2cf0c914eb270a8447282 Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Mon, 17 Sep 2012 20:10:09 +0200 Subject: [PATCH] add uint32ToTime --- zone.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/zone.go b/zone.go index 3436ab41..8063920b 100644 --- a/zone.go +++ b/zone.go @@ -494,15 +494,13 @@ func timeToUint32(t time.Time) uint32 { // uint32ToTime translates a uint32 to a time.Time func uint32ToTime(t uint32) time.Time { - /* // uint32 to duration and then add it to epoch(0) - mod := (time.Time.Unix() / year68) - 1 + mod := (time.Now().Unix() / year68) - 1 if mod < 0 { mod = 0 } -// duration := (mod * year68) * t -*/ - return time.Time{} + duration := time.Duration((mod * year68) * int64(t)) + return time.Unix(0,0).Add(duration) } // jitterTime returns a random +/- jitter