midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

Discussions, Bug Reports and Issues related to Beta versions of SharpCap
Post Reply
mfs4n
Posts: 12
Joined: Thu Mar 09, 2023 11:25 pm

midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

#1

Post by mfs4n »

First, thanks so much for adding the WAIT UNTIL AT LEAST LOCALTIME command. Having it available has significantly simplified the development of night-long scripts to do many time gated occultation observations.

Now that the nights are getting longer I'm starting up the scripts before UTC midnight. I'm finding that once I get past the midnight boundary the sequence will skip right through the wait statement because it thinks, for example, 01:00 UTC has already happened on the day the script started (which is true, but not the intention of the wait statement since the 01:00 UT in question is on the subsequent calendar day). I don't really want to change my system clock to a non-UTC time zone, but could as a last resort.

I don't see anything in the log that is relevant to debugging this issue but happy to post one if it would help.

Thanks,
Mike.
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

#2

Post by admin »

Hi Mike,

odd one, since as far as I can see the step does exactly what I intended it to, which is:

* As the step starts, get the date (local time date, not UTC)
* Add the specified time to the date to calculate a time point to wait until
* Wait until that time arrives (if it has happened already, carry on straight away)

Now, if your local time is set to UTC then the distinction between UTC and local time is irrelevant.

There is nothing in the code about the start time of the sequence, just the start time of that individual step, so if the step starts after midnight then it should wait for the set time. If it starts just before midnight then it will finish immediately, since the target time (03:00 or whatever) has already passed on that day.

If it still doesn't seem to be working right then please send me the log so I can check.

cheers,

Robin
mfs4n
Posts: 12
Joined: Thu Mar 09, 2023 11:25 pm

Re: midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

#3

Post by mfs4n »

Thanks. Let me try one more test this evening. I think what is happening is as you describe. I start a "wait until later than 01:00" at 23:45. Instead of waiting for one hour and fifteen minutes, the program decides that it is already past the 01:00 that occurred 22 hours and 45 minutes earlier and drops through the step. Any "wait until" starting after local midnight should be fine. A simple fix with the existing steps would be to insert a WAIT UNTIL LOCALTIME 00:05 or something like that when there is activity before midnight, so that the next "wait until later than" doesn't execute until after 00:00.
mfs4n
Posts: 12
Joined: Thu Mar 09, 2023 11:25 pm

Re: midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

#4

Post by mfs4n »

Ok. That's a workable solution - just don't start a "wait until later than" until you're on the same day as the time you care about in the future. A simple "WAIT UNTIL LOCALTIME 00:05" to hold off until after midnight gets me over the boundary.

Thanks,
Mike.
User avatar
admin
Site Admin
Posts: 13347
Joined: Sat Feb 11, 2017 3:52 pm
Location: Vale of the White Horse, UK
Contact:

Re: midnight rollover bug in WAIT UNTIL AT LEAST LOCALTIME

#5

Post by admin »

Hi Mike,

yes, that's the right approach. The two different options of 'Wait Until XX:XX' and 'Wait Until later than XX:XX' I think cover all the options.

cheers,

Robin
Post Reply