Documentation
¶
Index ¶
Constants ¶
View Source
const ( LangNone = "none" LangZhCN = "zh-CN" LangZhHK = "zh-HK" LangZhTW = "zh-TW" LangJaJP = "ja-JP" LangKoKr = "ko-KR" LangZhSg = "zh-SG" LangGlobal = "global" )
Variables ¶
View Source
var ( // 默认时区 LangCode = LangNone )
原子缓存,用于快速获取时间戳
Functions ¶
func ClearTimeSync ¶
func ClearTimeSync()
func GetCacheDir ¶
func GetTimeOffset ¶
func GetTimeOffset() int64
GetTimeOffset get time offset in milliseconds(>0 means local < standard)
func SetCacheValidDuration ¶
SetCacheValidDuration 设置缓存有效期
Types ¶
type OffsetRecord ¶
type OffsetRecord struct {
Timestamp int64 `json:"timestamp"` // 记录时间
Offset int64 `json:"offset"` // 时间偏移(毫秒)
}
偏移记录结构
type TimeSync ¶
type TimeSync struct {
// contains filtered or unexported fields
}
TimeSync 时间同步管理器
func SetTimeSync ¶
SetTimeSync init timeSyncer, call `ClearTimeSync` if reset is need
func (*TimeSync) SetOptions ¶
Click to show internal directories.
Click to hide internal directories.