Categorygithub.com/cpucycle/astrotime
modulepackage
0.0.0-20120927164819-9c7d514efdb5
Repository: https://github.com/cpucycle/astrotime.git
Documentation: pkg.go.dev

# README

astrotime

NOAA astrological algorithms for sunrise and sunset ported to Go

FUNCTIONS:

// CalcSunrise calculates the sunrise, in local time, on the day t at the
// location specified in longitude and latitude.
func CalcSunrise(t time.Time, latitude float64, longitude float64) time.Time

// NextSunrise returns date/time of the next sunrise after tAfter
func NextSunrise(tAfter time.Time, latitude float64, longitude float64) (tSunrise time.Time)

// CalcSunset calculates the sunset, in local time, on the day t at the
// location specified in longitude and latitude.
func CalcSunset(t time.Time, latitude float64, longitude float64) time.Time

// NextSunset returns date/time of the next sunset after tAfter
func NextSunset(tAfter time.Time, latitude float64, longitude float64) (tSunset time.Time)

EXAMPLE:

package main

import (
        "astrotime"
        "fmt"
        "time"
)

const LATITUDE = float64(38.8895)
const LONGITUDE = float64(77.0352)

func main() {
        t := astrotime.NextSunrise(time.Now(), LATITUDE, LONGITUDE)

        tzname, _ := t.Zone()
        fmt.Printf("The next sunrise at the Washington Monument is %d:%02d %s on %d/%d/%d.\n", t.Hour(), t.Minute(), tzname, t.Month(), t.Day(), t.Year())
}

# Functions

CalcJD converts a time.Time object to a julian date.
CalcSunrise calculates the sunrise, in local time, on the day t at the location specified in longitude and latitude.
CalcSunset calculates the sunset, in local time, on the day t at the location specified in longitude and latitude.
NextSunrise returns date/time of the next sunrise after tAfter.
NextSunset returns date/time of the next sunset after tAfter.

# Constants

Conversions.
Conversions.
More time constants.
Conversions.
Conversions.