sunriset

package
v1.4.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 11, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// LocalCST 本地时区
	LocalCST = time.FixedZone("CST", 8*3600)
)

Functions

func CalcSuntimeAstro

func CalcSuntimeAstro(lat float64, lng float64, date time.Time) (*time.Time, *time.Time, error)

CalcSuntimeAstro 使用starainrt/astro库计算日出日落 // year int, month time.Month, day int

func GetSunriseSunset

func GetSunriseSunset(latitude float64, longitude float64, utcOffset float64, date time.Time) (sunrise time.Time, sunset time.Time, err error)

GetSunriseSunset function is responsible for calculate the apparent Sunrise and Sunset times. If some parameter is wrong it will return an error.

func LeapYear

func LeapYear(year int) bool

LeapYear 判断是否闰年

Types

type Params

type Params struct {
	SunResult sync.Map
	Latitude  float64
	Longitude float64
	UtcOffset float64
	Year      int
}

Params The Parameters struct can also be used to manipulate the data and get the sunrise and sunset sunrise/sunset int hh*60+mm

func (*Params) Calculation

func (p *Params) Calculation() bool

Calculation 使用当前年份计算全年日出日落时间hh*60+mm,非润年,2月29日采用28日时间

func (*Params) Get

func (p *Params) Get(month, day int) (rise, set int)

Get 获取指定月日的日出日落时间

type Result

type Result struct {
	Month   int
	Day     int
	Sunrise int
	Sunset  int
}

Result 日出日落结果

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL