passforios-gopenpgp/time.go
2018-06-04 16:05:14 -07:00

25 lines
394 B
Go

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