mfreeborn / heliocron

A command line application written in Rust capable of delaying execution of other programs for time periods relative to sunrise and sunset.
Apache License 2.0
241 stars 11 forks source link

New Zealand time zone and location seems to fail #53

Closed chodgetts closed 2 years ago

chodgetts commented 2 years ago

So, I ran this command on my server at Midnight or just after, time zone config is in New Zealand Standard Time. (this is a Debian 10 install - downloaded heliocron binary package)

root@hostname:/date : Tue Jun 28 00:10:45 NZST 2022 Then ran : root@hostname:/heliocron -l 37.03216S -o 175.1220E wait --event sunrise && banner hello Which results in this error Runtime error: The chosen event occurred in the past: 2022-06-27 16:25:35 +12:00. Cannot wait a negative amount of time.

I have tried to run time zones, but all to no avail, even +18 hours results in a fail where it 'can not wait a negative amount of time' I might be having a dumb moment here, and not seeing something, but just am really puzzled as to what is going on.

I was going to send a private message as it had GPS locations in, but managed to move them enough away into forest land near my house to be happy enough to post..

Could you please suggest anything I could try to see if I could resolve this.. The fish will thank you for their wakeup with the sun and sleep with the setting sun...

mfreeborn commented 2 years ago

Please could you check the version (heliocron --version) and report back? A significant timezone bug was just fixed in the latest release, and it may be that the Debian package is lagging behind.

chodgetts commented 2 years ago

Hello, thank you for the reply :

heliocron 0.7.0

is what version I am currently running.

chodgetts commented 2 years ago

Update: It only seems to be the 'morning' sunrise timezone that seems to be the problem.. I need to wait till tomorrow, but I am pretty sure the 'sunset' wait works......

chodgetts commented 2 years ago

Right: I can confirm, 0.7.0 results in the 'sunrise' time being considered in the past. The 'solar_noon' time is correct, and the 'sunset' time is correct.

---- Sun Rise Cron job run at 4am with the following rule:

Cron root@server heliocron --longitude 174.86555445E --latitude 37.0842207S wait --event sunrise && /usr/local/bin/S20.pl ac:cf:23:35:dc:5a on

Runtime error: The chosen event occurred in the past: 2022-07-03 16:25:58 +12:00. Cannot wait a negative amount of time.

-- Sunset rule that was run at 15:30 : Cron root@server heliocron --longitude 174.86555445E --latitude 37.0842207S wait --event sunset && /usr/local/bin/S20.pl ac:cf:23:35:dc:5a off

Thread going to sleep for 6305 seconds until 2022-07-04 17:15:07 +12:00. Press ctrl+C to cancel.

and just for fun, I have a rule at 11:00 that emails 'at solar noon' -

Thread going to sleep for 5072 seconds until 2022-07-04 12:24:34 +12:00. Press ctrl+C to cancel. "This was sent at Solar Noon Precisely"

Sorry for the spam, just trying to give all the information I think you will need to investigate.

mfreeborn commented 2 years ago

Thanks for the update, hopefully later this week I'll be able to sit down and have a proper look at the code.


From: chodgetts @.> Sent: Monday, July 4, 2022 8:21:24 AM To: mfreeborn/heliocron @.> Cc: Michael Freeborn @.>; Comment @.> Subject: Re: [mfreeborn/heliocron] New Zealand time zone and location seems to fail (Issue #53)

Right: I can confirm, 0.7.0 results in the 'sunrise' time being considered in the past. The 'solar_noon' time is correct, and the 'sunset' time is correct.

---- Sun Rise Cron job run at 4am with the following rule:

Cron @.**@.> heliocron --longitude 174.86555445E --latitude 37.0842207S wait --event sunrise && /usr/local/bin/S20.pl ac:cf:23:35:dc:5a on

Runtime error: The chosen event occurred in the past: 2022-07-03 16:25:58 +12:00. Cannot wait a negative amount of time.

-- Sunset rule that was run at 15:30 : Cron @.**@.> heliocron --longitude 174.86555445E --latitude 37.0842207S wait --event sunset && /usr/local/bin/S20.pl ac:cf:23:35:dc:5a off

Thread going to sleep for 6305 seconds until 2022-07-04 17:15:07 +12:00. Press ctrl+C to cancel.

and just for fun, I have a rule at 11:00 that emails 'at solar noon' -

Thread going to sleep for 5072 seconds until 2022-07-04 12:24:34 +12:00. Press ctrl+C to cancel. "This was sent at Solar Noon Precisely"

Sorry for the spam, just trying to give all the information I think you will need to investigate.

— Reply to this email directly, view it on GitHubhttps://github.com/mfreeborn/heliocron/issues/53#issuecomment-1173444975, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AHSVKWAELIQNAGNZQRQ5PLDVSKGHJANCNFSM5Z6JWO6Q. You are receiving this because you commented.Message ID: @.***>

chodgetts commented 2 years ago

Thank you so much, Sorry to be a pain on this one, I wish I could help, but I would not know where to start :( I do appreciate your effort on this code, and your time you are giving to the project. I will wait until a new update comes through, and see how we go :)

Thanks so much.