passforios-gopenpgp/time.go
2018-06-04 17:50:26 -07:00

24 lines
379 B
Go

package pm
import (
"time"
)
// UpdateTime update cached time
func (o *OpenPGP) UpdateTime(newTime int64) {
o.latestServerTime = newTime
}
//GetTime get latest cached time
func (o *OpenPGP) GetTime() int64 {
return o.latestServerTime
}
func (o *OpenPGP) getNow() time.Time {
if o.latestServerTime > 0 {
return time.Unix(o.latestServerTime, 0)
}
return time.Now()
}