src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

README.md (1578B)


      1 ## go-sunrise
      2 
      3 [![Build Status](https://app.travis-ci.com/nathan-osman/go-sunrise.svg?branch=master)](https://app.travis-ci.com/nathan-osman/go-sunrise)
      4 [![Coverage Status](https://coveralls.io/repos/github/nathan-osman/go-sunrise/badge.svg?branch=master)](https://coveralls.io/github/nathan-osman/go-sunrise?branch=master)
      5 [![Go Report Card](https://goreportcard.com/badge/github.com/nathan-osman/go-sunrise)](https://goreportcard.com/report/github.com/nathan-osman/go-sunrise)
      6 [![GoDoc](https://godoc.org/github.com/nathan-osman/go-sunrise?status.svg)](https://godoc.org/github.com/nathan-osman/go-sunrise)
      7 [![MIT License](http://img.shields.io/badge/license-MIT-9370d8.svg?style=flat)](http://opensource.org/licenses/MIT)
      8 
      9 Go package for calculating the sunrise and sunset times for a given location based on [this method](https://en.wikipedia.org/wiki/Sunrise_equation#Complete_calculation_on_Earth).
     10 
     11 ### Usage
     12 
     13 To calculate sunrise and sunset times, you will need the following information:
     14 
     15 - the date for which you wish to calculate the times
     16 - the latitude and longitudinal coordinates of the location
     17 
     18 Begin by importing the package:
     19 
     20     import "github.com/nathan-osman/go-sunrise"
     21 
     22 Next, feed the information into the SunriseSunset() method:
     23 
     24     rise, set := sunrise.SunriseSunset(
     25         43.65, -79.38,          // Toronto, CA
     26         2000, time.January, 1,  // 2000-01-01
     27     )
     28 
     29 The two return values will be the sunrise and sunset times for the location on the given day as time.Time values. If sun does not rise or set, both return values will be time.Time{}.