Clock Manager/AstrClock DST?
vining
Posts: 4,368
Does anyone know if I SET all the appropriate Clock Manager values as such:
The pic below shows the GET returns after values have been set to verify they have indeed been set.
CLKMGR_SET_CLK_SOURCE(CLKMGR_MODE_NETWORK) ; // or CLKMGR_MODE_STANDALONE CLKMGR_SET_ACTIVE_TIMESERVER (CLKMGR_ACTIVESERVER) ; CLKMGR_SET_TIMEZONE(CLKMGR_TIME_ZONE) ; CLKMGR_SET_DAYLIGHTSAVINGS_MODE(TRUE) ; CLKMGR_SET_START_DAYLIGHTSAVINGS_RULE("'occurrence:',itoa(DST_BEGINDAY_OCCURANCE),',',itoa(DST_BEGIN_DAY),',',itoa(DST_BEGIN_MONTH),',',DST_BEGIN_TIME" ) ; CLKMGR_SET_END_DAYLIGHTSAVINGS_RULE("'occurrence:',itoa(DST_ENDDAY_OCCURANCE),',',itoa(DST_END_DAY),',',itoa(DST_END_MONTH),',',DST_END_TIME" ) ; CLKMGR_SET_RESYNC_PERIOD(CLKMGR_RESYNC_PERIOD) ; sMyCLKMGR_TIMEOFFSET.HOURS = CLKMGR_DST_OFFSET_HR ; sMyCLKMGR_TIMEOFFSET.MINUTES = CLKMGR_DST_OFFSET_MIN ; sMyCLKMGR_TIMEOFFSET.SECONDS = CLKMGR_DST_OFFSET_SEC ; CLKMGR_SET_DAYLIGHTSAVINGS_OFFSET(sMyCLKMGR_TIMEOFFSET) ;Assuming they're all set correctly and then call AstroClock:
ASTRO_CLOCK(CLKMGR_LAT,CLKMGR_LONG,CLKMGR_OFFSET_GMT,LDATE,sMyTime.cSunrise,sMyTime.cSunset);Is this supposed to return the correct sunrise/sunset based on DST rules or do I need change CLKMGR_OFFSET_GMT which has a value of -5.0 to CLKMGR_OFFSET_EST (value -5.0) or CLKMGR_OFFSET_EDT (value -4.0) based on the return received from calling:
sGet_ClkMgr.nIs_DST_On = CLKMGR_IS_DAYLIGHTSAVINGS_ON();I would think the clock manager would take care of that logic and I shouldn't have to call CLKMGR_IS_DAYLIGHTSAVINGS_ON() to determine if I should send EST or EDT in the ASTRO_CLOCK call but since my sunrise and sunset times are an hour behind maybe I need to.
The pic below shows the GET returns after values have been set to verify they have indeed been set.
0
Comments
The return value from CLKMGR_IS_DAYLIGHTSAVINGS_ON() does not tell you if DST is currently active; it only tells you whether Daylight Saving Time is observed. If you want to know if Daylight Saving Time is currently active then you need to make the calculation yourself based on the start and end rules. If DST is currently active then you’ll need to add one hour to sunrise and sunset calculated by ASTRO_CLOCK. (Unless you are doing a job in some place like Lord Howe Island, Australia where DST is only a 30 minute change – yikes)
I know there have been several posts over the years asking for a simple flag to tell us if Daylight Saving Time is currently active but as far as I know no such built-in function exists.
As an aside – Even though all the clock manager functions refer to it as Daylight Savings, the correct term is Daylight Saving.
I already have a function to dertermine if DST is active that i can use to send either EST or EDT offset but i just assumed Is_dst_on would also give me that status but it looks like I'm wrong again.
The docs don't don't really help any either. Thanks for the clarification.
I tried it long ago and it doesn’t work.
This year in the USA, DST starts on Sunday March 10th and ends on Sunday November 3rd.
Your function returns true for every day in March (March 1 – March 9 incorrect) and your function returns false for every day in November (November 1 and November 2 incorrect.)
Thought you and whoever else might be using it should know.
Then yes, this is a bug and really needs fixed, I will look into it. thanks
I attached my include file and if anyone wants to use it there are some function calls that need to be commented out or the functions created in your main code. Basically just calls from the Date and Time inlcude to run events based on time that I run in the main since I don't want them placed in the include file. Every Second, Minute, Hour, Daily type of crap.