func (op *Payload_OtpParameters) Second() float64 {
	return now().Sub(now().Truncate(period)).Seconds()
}
Second of current validity frame
package migration
import (
	"crypto/hmac"
	"crypto/md5"
	"crypto/sha1"
	"crypto/sha256"
	"crypto/sha512"
	"encoding/binary"
	"fmt"
	"hash"
	"time"
)
var (
	hashFunc = map[Payload_Algorithm]func() hash.Hash{
		Payload_ALGORITHM_UNSPECIFIED: sha1.New,  
		Payload_ALGORITHM_SHA1:        sha1.New,
		Payload_ALGORITHM_SHA256:      sha256.New,
		Payload_ALGORITHM_SHA512:      sha512.New,
		Payload_ALGORITHM_MD5:         md5.New,
	}
	digitCount = map[Payload_DigitCount]int{
		Payload_DIGIT_COUNT_UNSPECIFIED: 1e6,  
		Payload_DIGIT_COUNT_SIX:         1e6,
		Payload_DIGIT_COUNT_EIGHT:       1e8,
	}
	countFunc = map[Payload_OtpType]func(*Payload_OtpParameters) uint64{
		Payload_OTP_TYPE_UNSPECIFIED: totp,  
		Payload_OTP_TYPE_HOTP:        hotp,
		Payload_OTP_TYPE_TOTP:        totp,
	}
	fmtWidth = map[Payload_DigitCount]int{
		Payload_DIGIT_COUNT_UNSPECIFIED: 6,  
		Payload_DIGIT_COUNT_SIX:         6,
		Payload_DIGIT_COUNT_EIGHT:       8,
	}
)
const (
	offset = 5 * time.Second   
	period = 30 * time.Second  
)
var now = func() time.Time { return time.Now().Add(offset) }
func hotp(op *Payload_OtpParameters) uint64 {
	op.Counter++  
	return op.Counter
}
func totp(op *Payload_OtpParameters) uint64 {
	return uint64(now().Unix()) / uint64(period.Seconds())
}