Commit: b637714bea26a3550c4f0ae6bb5f68853c9a93a7 Parent: 26bcf55822737f24df800d73055d3ad4865e114b Author: Vi Grey Date: 2024-05-29 14:06 UTC Summary: Add solarTimeSecondsOffset and rfc3339 values README.txt | 6 ++++-- src/syzygy.go | 45 ++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/README.txt b/README.txt index 8efd3e9..381e26d 100644 --- a/README.txt +++ b/README.txt @@ -118,7 +118,7 @@ The above command will provide the following output "equationOfTime": { "eccentricity": -1.8414647539088742, "obliquity": 2.08068776123484, - "secondsOffset": 57.41352175823174 + "secondsOffset": 57.41352175823174, }, "eclipse": { "local": false, @@ -128,6 +128,8 @@ The above command will provide the following output "sunEclipticLongitude": 29.798842962357107, "moonEclipticLongitude": 29.308224392458214, "sunEarthMoonAngle": 0.6551216488634518, - "time": 1681960707.141592 + "solarTimeSecondsOffset": -21034.708942241767, + "time": 1681960707.141592, + "rfc3339": "2023-04-20T03:18:27.141592Z" } ``` diff --git a/src/syzygy.go b/src/syzygy.go index 678f0f0..763f460 100644 --- a/src/syzygy.go +++ b/src/syzygy.go @@ -463,25 +463,27 @@ var ( ) type Syzygy struct { - MoonIllumination float64 `json:"moonIllumination"` - MoonPhase float64 `json:"moonPhase"` - SunAngle float64 `json:"sunAngle"` - MoonAngle float64 `json:"moonAngle"` - SunVisible bool `json:"sunVisible"` - MoonVisible bool `json:"moonVisible"` - SunGeodeticLocation LLA `json:"sunGeodeticLocation"` - MoonGeodeticLocation LLA `json:"moonGeodeticLocation"` - EarthGeodeticLocation LLA `json:"earthGeodeticLocation"` - SunECEF XYZ `json:"sunECEF"` - MoonECEF XYZ `json:"moonECEF"` - EarthECEF XYZ `json:"earthECEF"` - EoT EquationOfTime `json:"equationOfTime"` - Ecl Eclipse `json:"eclipse"` - SunEarthPhase float64 `json:"sunEarthPhase"` - SunEclipticLongitude float64 `json:"sunEclipticLongitude"` - MoonEclipticLongitude float64 `json:"moonEclipticLongitude"` - SunEarthMoonAngle float64 `json:"sunEarthMoonAngle"` - Time float64 `json:"time"` + MoonIllumination float64 `json:"moonIllumination"` + MoonPhase float64 `json:"moonPhase"` + SunAngle float64 `json:"sunAngle"` + MoonAngle float64 `json:"moonAngle"` + SunVisible bool `json:"sunVisible"` + MoonVisible bool `json:"moonVisible"` + SunGeodeticLocation LLA `json:"sunGeodeticLocation"` + MoonGeodeticLocation LLA `json:"moonGeodeticLocation"` + EarthGeodeticLocation LLA `json:"earthGeodeticLocation"` + SunECEF XYZ `json:"sunECEF"` + MoonECEF XYZ `json:"moonECEF"` + EarthECEF XYZ `json:"earthECEF"` + EoT EquationOfTime `json:"equationOfTime"` + Ecl Eclipse `json:"eclipse"` + SunEarthPhase float64 `json:"sunEarthPhase"` + SunEclipticLongitude float64 `json:"sunEclipticLongitude"` + MoonEclipticLongitude float64 `json:"moonEclipticLongitude"` + SunEarthMoonAngle float64 `json:"sunEarthMoonAngle"` + SolarTimeSecondsOffset float64 `json:"solarTimeSecondsOffset"` + Time float64 `json:"time"` + RFC3339 string `json:"rfc3339"` } type XYZ struct { @@ -1080,7 +1082,12 @@ func main() { s.SunEclipticLongitude = sunApparentLon s.MoonEclipticLongitude = moonApparentLon s.SunEarthMoonAngle = radiansToDegrees(arcl) + s.SolarTimeSecondsOffset = earthLLA.Longitude*240 + eot.SecondsOffset s.Time = specifiedTime + specifiedTimeSeconds, specifiedTimeNano := math.Modf(specifiedTime) + sTime := time.Unix(int64(specifiedTimeSeconds), + int64(specifiedTimeNano*1000000000)).UTC() + s.RFC3339 = sTime.Format("2006-01-02T15:04:05.999999Z") lunarEclipsePossible := moonPhase > 90 && moonPhase < 270 var ecl Eclipse if lunarEclipsePossible {