using Innovative.SolarCalculator;
using Innovative.Geometry;
public static DateTime AngleTime(Angle angle, SolarTimes sunDetails)
DateTimeOffset zman = new DateTimeOffset(sunDetails.ForDate.Ticks, sunDetails.ForDate.Offset);
if (sunDetails.SolarElevation < (double)-3)
while (sunDetails.SolarElevation <= angle)
zman = zman.AddMinutes(1);
sunDetails.ForDate = zman;
while (sunDetails.SolarElevation >= angle)
zman = zman.AddMinutes(1);
sunDetails.ForDate = zman;
return new DateTime(zman.Ticks);
public static void OrHachaimTimes()
TimeSpan offset = new TimeSpan(TimeZoneInfo.ConvertTimeBySystemTimeZoneId(DateTimeOffset.UtcNow, "Israel Standard Time").Offset.Ticks);
DateTimeOffset localDate = new DateTimeOffset(DateTime.Today.Ticks, offset);
SolarTimes sunSolar = new SolarTimes(localDate, 32.109333, 34.855499);
DateTime sunrise = sunSolar.Sunrise;
DateTime sunset = sunSolar.Sunset;
DateTime realSunrise = sunrise.AddMinutes(-4);
DateTime realSunset = sunset.AddMinutes(4);
TimeSpan difference = realSunset.Subtract(realSunrise);
double differenceInMin = difference.TotalMinutes;
TimeSpan TempHour = TimeSpan.FromMinutes(((differenceInMin) / 12));
TimeSpan TempMin = TimeSpan.FromMinutes(TempHour.TotalMinutes / 60);
Console.WriteLine(TempHour);
Console.WriteLine(TempMin);
Console.WriteLine(sunrise);
Console.WriteLine(sunset);
public static void Main()