Posts: 696
Threads: 62
Joined: Jun 2010
How does CQC handle DST? I have shades set to go down 30 minutes after sunrise. Today, first day of DST, they went down while it was still pitch black outside. I guess that would mean that my CQC did not adjust sunrise to DST.
There must be someplace I haven't found yet that one would check to observe DST.
Posts: 40,483
Threads: 491
Joined: Aug 2002
No, this is a known issue that just hasn't been dealt with. The scheduled event server pre-schedules the next time for an event after it is run, and puts it into a sorted list by time, so that it just has to look at the top entry's scheduled time and the current time and decide if it's time to do anything. So the one that ran today was scheduled yesterday, after it ran which was before the time change. They'll be correct again now. It only messes up the one day.
Sorry about that. It sounds like it would be easy to fix, but it's not. Anything to do with the scheduler requires careful consideration because it's so hard to really test correctly, and so tricky to get right (as is anything time related really.)
Dean Roddey
Explorans limites defectum
Posts: 696
Threads: 62
Joined: Jun 2010
03-08-2015, 08:33 AM
(This post was last modified: 03-08-2015, 08:35 AM by Deane Johnson.)
One day I can certainly live with. I'm glad to know that's the issue so I don't go messing with it. Sounds like a non-problem.
I suppose I'm a bit curious if there is a place in CQC to opt for DST since there are localities that don't observe it. I don't happen to be in one of them.
Posts: 40,483
Threads: 491
Joined: Aug 2002
CQC would just use the system settings for that. It's not that CQC doesn't know about DST, since it can get that info. It's just that there would have to be a very special case scenario that only happens two days a year and that would have to be done by checking whether DST changed, at whatever time it's supposed to change in any given location. Unless there's a query to ask for the day that it's going to change.
Dean Roddey
Explorans limites defectum
Posts: 696
Threads: 62
Joined: Jun 2010
I suppose what isn't clicking for me is how CQC knows it should adjust events 1 hr when they relate to sunrise/sunset, since these occurrences are arbitrarily different. By arbitrarily, I mean be local jurisdiction.
As a for instance, my computer system will adjust for DST and the correct time will be displayed by the computer. However, when the change to DST takes place, an event time to sunrise has to be offset one way or another.
A for instance: Let's say sunrise is 8:00 am during standard time. I have an event set to happen 30 minutes after sunrise, or happening at 8:30 am. Then, DST comes along and my computer clock now reads 9:00 am when the sunrise occurs. That means CQC has to make a one hour adjustment when triggering off of sunrise during DST.
So I guess my question is: does CQC internally make that adjustment so that events tied to sunrise remain properly anchored to sunrise? I'm assuming it does. The additional question would then be, is it selectable? What do the people in Arizona do, if not?
Posts: 40,483
Threads: 491
Joined: Aug 2002
Well, sunrise/sunset calculations are based on both DST and lat/long info. Both are used when the next runtime is calculated. It's just that the next run time is calculated at the point when the current runtime has just been passed and the event queued up. At that point, it knows that the next runtime has to be in the future, so it moves forward to the next possible runtime for that type of event.
But, because it pre-calculates them, it uses todays DST to calculate a time for tomorrow. It doesn't have a way to know that tomorrow is going to be a different DST.
So it's just that pre-calculation of the next runtime that causes it. Otherwise, it would have to wake up constantly and calculate them all and see if it's time. By pre-calculating, it can just maintain a sorted list by time and knows it doesn't have to do anything until the time of the top one if the list arrives.
So it's really efficient, but without a way of knowing that tomorrow the DST is going to change, it will get it wrong for one day. I'll have to see if there's some way of asking Windows when the DST change is going to occur or something like that and keep that info around. I'm not sure if there is such a thing though. If not, then I'd have to give up on pre-calculating runtimes, which would be a really big change in how it works.
Dean Roddey
Explorans limites defectum
Posts: 696
Threads: 62
Joined: Jun 2010
03-08-2015, 11:46 AM
(This post was last modified: 03-08-2015, 11:49 AM by Deane Johnson.)
Dean, I don't consider that one day thing to be an issue. Perhaps someone else might have an installation that was more critical, but I don't.
My question is more one of curiousity. If I suddenly moved to Arizona where they don't observe DST, how does my new installation of CQC know not to observe it as it does in other parts of the country.
Posts: 2,407
Threads: 244
Joined: Oct 2007
I think CQC just uses the system clock so if your computer observes dst so does CQC.
Posts: 40,483
Threads: 491
Joined: Aug 2002
potts.mike Wrote:I think CQC just uses the system clock so if your computer observes dst so does CQC.
Yep, that would be it. The system would just never report DST being in force if DST isn't used where you are, so CQC would always think it's in a non-DST state. As long as Windows correctly understands DST for your area, CQC will as well.
Dean Roddey
Explorans limites defectum
Posts: 696
Threads: 62
Joined: Jun 2010
That makes sense and answers my curiosity.