package timer

import (
	"time"
)

func CalculateTime(hour int) int64 {
	now := time.Now()

	targetTime := time.Date(now.Year(), now.Month(), now.Day(), hour, 0, 0, 0, now.Location())
	if now.After(targetTime) {
		targetTime = targetTime.AddDate(0, 0, 1)
	}

	toTarget := targetTime.Sub(now)
	sec := toTarget.Nanoseconds()

	return sec
}
