daylight.frink

View or download daylight.frink in plain text format


// Calculates duration of daylight over the course of a year.

// Requires the sun.frink high-precision astronomical library.
use sun.frink

lat =   40 degrees North
long = 105 degrees West
TZ =   "US/Mountain"

out =  ### yyyy-MM-dd ###
time = ### HH:mm:ss ###

temp = F[64]
pressure = 29.90 inHg

for date = #2017# to #2018# step 1 day
{
   sunrise = sunrise[date, lat, long, temp, pressure]
   sunset  = sunset[date, lat, long, temp, pressure]

   daylength = sunset - sunrise

   print[(date -> out) + "\t" + (daylength -> [hour, min, sec, 0])]
   println["\t" + (sunrise -> [time, TZ]) + "\t" + (sunset-> [time, TZ])]
}


View or download daylight.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 17649 days, 5 hours, 43 minutes ago.