fix:时区转换问题

This commit is contained in:
2024-10-26 21:28:26 +08:00
parent d479d39352
commit 616cd54222
7 changed files with 81 additions and 44 deletions
+16 -4
View File
@@ -7,8 +7,20 @@ import (
)
func TestMercury(t *testing.T) {
date := time.Now().Add(time.Hour * -24)
fmt.Println(CulminationTime(date, 115))
fmt.Println(RiseTime(date, 115, 23, 0, false))
fmt.Println(DownTime(date, 115, 23, 0, false))
tz := time.FixedZone("CST", 8*3600)
date := time.Date(2022, 01, 20, 00, 00, 00, 00, tz)
if NextConjunction(date).Unix() != 1642933683 {
t.Fatal(NextConjunction(date).Unix())
}
if CulminationTime(date, 115).Unix() != 1642654651 {
t.Fatal(CulminationTime(date, 115).Unix())
}
date, err := (RiseTime(date, 115, 40, 0, false))
if err != nil {
t.Fatal(err)
}
if date.Unix() != 1642636481 {
t.Fatal(date.Unix())
}
fmt.Println(DownTime(date, 115, 40, 0, false))
}