package controller

import (
	"netease_control_center/utils/customization"
	"netease_control_center/utils/ntp"
	"sync"
	"netease_control_center/globals"
	"time"
	"netease_control_center/interfaces/log"
	"math/rand"
)

var (
	once_caltimesuccess sync.Once
)

func init() {
	ntp.CalTimeSuccessCb = calTimeSuccess
}

func calTimeSuccess() {
	once_caltimesuccess.Do(func() {
		Nduilite_fespa_set()
		UpdateMicStatus(true)
		UpdateCronTime()
		go customization.DoCheck(5)
		globals.FirstCalTime = time.Now()
		rand.Seed(time.Now().UnixNano())
		log.Println(log.DebugLog, "Firstly cal time:", globals.FirstCalTime)
	})
}
