Wrong time output

The following code

package main

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

const LATITUDE = float64(51.1387)
const LONGITUDE = float64(7.2997)

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

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

displays the incorrect time. The time is displayed too late by one hour.

For example: Output: 7:57 CEST, correctly would 6:57 CEST.

Whats wrong?

To me it looks as if the astrotime calculations do not take DST into account. 6:57 CEST would be 7:57 CET. A one-hour error like this is typical for DST problems.

I did a quick search in the github repository of astrotime and did not find any occurrence of “dst”, “daylight”, or “summer”. I did not look into the code or documentation of the original C++ code that astrotime was ported from.

So my guess is that astrotime simply ignores DST.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.