本文整理汇总了Golang中github.com/keybase/client/go/protocol.ToTime函数的典型用法代码示例。如果您正苦于以下问题:Golang ToTime函数的具体用法?Golang ToTime怎么用?Golang ToTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ToTime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ParseDevice
func ParseDevice(jw *jsonw.Wrapper, t time.Time) (ret *Device, err error) {
var obj Device
if err = jw.UnmarshalAgain(&obj); err == nil {
ret = &obj
ret.CTime = keybase1.ToTime(t)
ret.MTime = keybase1.ToTime(t)
}
return
}
示例2: Export
func (cr CheckResult) Export() *keybase1.CheckResult {
return &keybase1.CheckResult{
ProofResult: ExportProofError(cr.Status),
Time: keybase1.ToTime(cr.Time),
Freshness: cr.Freshness(),
}
}
示例3: Export
func (cr CheckResult) Export() *keybase1.CheckResult {
return &keybase1.CheckResult{
ProofResult: ExportProofError(cr.Status),
Time: keybase1.ToTime(cr.Time),
DisplayMarkup: cr.ToDisplayString(),
}
}
示例4: Insert
func (i *Identify2WithUIDTester) Insert(up *keybase1.UserPlusKeys) error {
tmp := *up
copy := &tmp
copy.Uvv.CachedAt = keybase1.ToTime(i.now)
i.cache[up.Uid] = copy
return nil
}
示例5: ExportToUncheckedIdentity
func (ir IdentifyOutcome) ExportToUncheckedIdentity() *keybase1.Identity {
tmp := keybase1.Identity{
Status: ExportErrorAsStatus(ir.Error),
}
if ir.TrackUsed != nil {
tmp.WhenLastTracked = keybase1.ToTime(ir.TrackUsed.GetCTime())
}
pc := ir.ProofChecksSorted()
tmp.Proofs = make([]keybase1.IdentifyRow, len(pc))
for j, p := range pc {
tmp.Proofs[j] = p.ExportToIdentifyRow(j)
}
tmp.Revoked = make([]keybase1.TrackDiff, len(ir.Revoked))
for j, d := range ir.Revoked {
// Should have all non-nil elements...
tmp.Revoked[j] = *ExportTrackDiff(d)
if d.BreaksTracking() {
tmp.BreaksTracking = true
}
}
tmp.RevokedDetails = ir.RevokedDetails
return &tmp
}
示例6: ExportRemoteProof
func ExportRemoteProof(p RemoteProofChainLink) keybase1.RemoteProof {
k, v := p.ToKeyValuePair()
return keybase1.RemoteProof{
ProofType: p.GetProofType(),
Key: k,
Value: v,
DisplayMarkup: v,
SigID: p.GetSigID(),
MTime: keybase1.ToTime(p.GetCTime()),
}
}
示例7: revokeDeviceForTesting
func (k *KeybaseDaemonLocal) revokeDeviceForTesting(clock Clock,
uid keybase1.UID, index int) error {
k.lock.Lock()
defer k.lock.Unlock()
user, err := k.localUsers.getLocalUser(uid)
if err != nil {
return fmt.Errorf("No such user %s: %v", uid, err)
}
if index >= len(user.VerifyingKeys) ||
(k.currentUID == uid && index == user.CurrentCryptPublicKeyIndex) {
return fmt.Errorf("Can't revoke index %d", index)
}
if user.RevokedVerifyingKeys == nil {
user.RevokedVerifyingKeys = make(map[VerifyingKey]keybase1.KeybaseTime)
}
if user.RevokedCryptPublicKeys == nil {
user.RevokedCryptPublicKeys =
make(map[CryptPublicKey]keybase1.KeybaseTime)
}
kbtime := keybase1.KeybaseTime{
Unix: keybase1.ToTime(clock.Now()),
Chain: 100,
}
user.RevokedVerifyingKeys[user.VerifyingKeys[index]] = kbtime
user.RevokedCryptPublicKeys[user.CryptPublicKeys[index]] = kbtime
user.VerifyingKeys = append(user.VerifyingKeys[:index],
user.VerifyingKeys[index+1:]...)
user.CryptPublicKeys = append(user.CryptPublicKeys[:index],
user.CryptPublicKeys[index+1:]...)
if k.currentUID == uid && index < user.CurrentCryptPublicKeyIndex {
user.CurrentCryptPublicKeyIndex--
}
if k.currentUID == uid && index < user.CurrentVerifyingKeyIndex {
user.CurrentVerifyingKeyIndex--
}
k.localUsers[uid] = user
return nil
}
示例8: runTable
func (e *ListTrackingEngine) runTable(trackList TrackList) error {
for _, link := range trackList {
uid, err := link.GetTrackedUID()
if err != nil {
return err
}
entry := keybase1.UserSummary{
Username: link.ToDisplayString(),
SigIDDisplay: link.GetSigID().ToDisplayString(true),
TrackTime: keybase1.ToTime(link.GetCTime()),
Uid: keybase1.UID(uid),
}
entry.Proofs.PublicKeys = e.linkPGPKeys(link)
entry.Proofs.Social = e.linkSocialProofs(link)
entry.Proofs.Web = e.linkWebProofs(link)
e.tableResult = append(e.tableResult, entry)
}
return nil
}
示例9: Check
// Check checks for an update. If not requested (by user) and not forced it will
// exit early if check has already been applied within checkDuration().
func (u *UpdateChecker) Check(force bool, requested bool) error {
if !requested && !force {
if lastCheckedPTime := u.updater.config.GetUpdateLastChecked(); lastCheckedPTime > 0 {
lastChecked := keybase1.FromTime(lastCheckedPTime)
if time.Now().Before(lastChecked.Add(checkDuration())) {
u.log.Debug("Already checked: %s", lastChecked)
return nil
}
}
}
checkTime := time.Now()
_, err := u.updater.Update(u.ui, force, requested)
if err != nil {
return err
}
u.log.Debug("Saving updater last checked: %s", checkTime)
u.updater.config.SetUpdateLastChecked(keybase1.ToTime(checkTime))
return nil
}
示例10: Sigs
// Sigs returns the sig list, after processing.
func (e *SigsList) Sigs() []keybase1.Sig {
res := make([]keybase1.Sig, len(e.sigs))
for i, s := range e.sigs {
var key string
fp := s.GetPGPFingerprint()
if fp != nil {
key = fp.ToDisplayString(e.Verbose)
}
res[i] = keybase1.Sig{
Seqno: int(s.GetSeqno()),
SigIDDisplay: s.GetSigID().ToDisplayString(e.Verbose),
Type: s.Type(),
CTime: keybase1.ToTime(s.GetCTime()),
Revoked: s.IsRevoked(),
Active: e.isActiveKey(s),
Key: key,
Body: s.ToDisplayString(),
}
}
return res
}
示例11: makeTestKBPKIClientWithRevokedKey
func makeTestKBPKIClientWithRevokedKey(t *testing.T, revokeTime time.Time) (
client *KBPKIClient, currentUID keybase1.UID, users []LocalUser) {
currentUID = keybase1.MakeTestUID(1)
names := []libkb.NormalizedUsername{"test_name1", "test_name2"}
users = MakeLocalUsers(names)
// Give each user a revoked key
for i, user := range users {
index := 99
keySalt := keySaltForUserDevice(user.Name, index)
newVerifyingKey := MakeLocalUserVerifyingKeyOrBust(keySalt)
user.RevokedVerifyingKeys = map[VerifyingKey]keybase1.KeybaseTime{
newVerifyingKey: {Unix: keybase1.ToTime(revokeTime), Chain: 100},
}
users[i] = user
}
codec := NewCodecMsgpack()
daemon := NewKeybaseDaemonMemory(currentUID, users, codec)
config := &ConfigLocal{codec: codec, daemon: daemon}
setTestLogger(config, t)
return NewKBPKIClient(config), currentUID, users
}
示例12: syncFromServer
func (t *Tracker2Syncer) syncFromServer(uid keybase1.UID, sr SessionReader) (err error) {
defer t.G().Trace(fmt.Sprintf("syncFromServer(%s)", uid), func() error { return err })()
hargs := HTTPArgs{
"uid": UIDArg(uid),
"reverse": B{t.reverse},
"autoCamel": B{true},
}
lv := t.getLoadedVersion()
if lv >= 0 {
hargs.Add("version", I{lv})
}
var res *APIRes
res, err = t.G().API.Get(APIArg{
Endpoint: "user/list_followers_for_display",
Args: hargs,
NeedSession: false,
})
t.G().Log.Debug("| syncFromServer() -> %s", ErrToOk(err))
if err != nil {
return err
}
var tmp keybase1.UserSummary2Set
if err = res.Body.UnmarshalAgain(&tmp); err != nil {
return
}
tmp.Time = keybase1.ToTime(time.Now())
if lv < 0 || tmp.Version > lv {
t.G().Log.Debug("| syncFromServer(): got update %d > %d (%d records)", tmp.Version, lv,
len(tmp.Users))
t.res = &tmp
t.dirty = true
} else {
t.G().Log.Debug("| syncFromServer(): no change needed @ %d", lv)
}
return nil
}
示例13: Check
func (u *UpdateChecker) Check(force bool, requested bool) error {
ui, _ := u.ui.GetUpdateUI()
if ui == nil && !force {
return fmt.Errorf("No UI for update check")
}
if !requested && !force {
if lastCheckedPTime := u.updater.config.GetUpdateLastChecked(); lastCheckedPTime > 0 {
lastChecked := keybase1.FromTime(lastCheckedPTime)
if time.Now().Before(lastChecked.Add(checkDuration())) {
u.log.Debug("Already checked: %s", lastChecked)
return nil
}
}
}
_, err := u.updater.Update(ui, force, requested)
if err != nil {
return err
}
u.log.Debug("Updater checked")
u.updater.config.SetUpdateLastChecked(keybase1.ToTime(time.Now()))
return nil
}
示例14: toUserPlusKeys
func (e *Identify2WithUID) toUserPlusKeys() keybase1.UserPlusKeys {
return e.them.ExportToUserPlusKeys(keybase1.ToTime(e.getNow()))
}
示例15: Insert
// Insert adds a user to the cache, keyed on UID.
func (c *Identify2Cache) Insert(up *keybase1.UserPlusKeys) error {
tmp := *up
copy := &tmp
copy.Uvv.CachedAt = keybase1.ToTime(time.Now())
return c.cache.Set(string(up.Uid), copy)
}