mirror of
https://github.com/iyear/tdl
synced 2025-01-09 04:17:35 +08:00
feat(tgc): use ntp clock when flag is set
This commit is contained in:
parent
a489a06837
commit
87b570252a
@ -1,6 +1,7 @@
|
||||
package tgc
|
||||
|
||||
import (
|
||||
tdclock "github.com/gotd/td/clock"
|
||||
"github.com/gotd/td/telegram"
|
||||
"github.com/gotd/td/telegram/dcs"
|
||||
"github.com/iyear/tdl/pkg/clock"
|
||||
@ -9,13 +10,22 @@ import (
|
||||
"github.com/iyear/tdl/pkg/logger"
|
||||
"github.com/iyear/tdl/pkg/storage"
|
||||
"github.com/iyear/tdl/pkg/utils"
|
||||
"github.com/spf13/viper"
|
||||
"time"
|
||||
)
|
||||
|
||||
func New(proxy string, kvd *kv.KV, login bool, middlewares ...telegram.Middleware) (*telegram.Client, error) {
|
||||
_clock, err := clock.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var (
|
||||
_clock tdclock.Clock
|
||||
err error
|
||||
)
|
||||
|
||||
_clock = tdclock.System
|
||||
if ntp := viper.GetString(consts.FlagNTP); ntp != "" {
|
||||
_clock, err = clock.New()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
return telegram.NewClient(consts.AppID, consts.AppHash, telegram.Options{
|
||||
|
Loading…
Reference in New Issue
Block a user