Home AMX User Forum AMXForums Archive Threads AMX Applications and Solutions

How do I figure Daylight Savings Status?

I am trying to figure out in my code whether we are currently in Daylight Savings or in Standard Time. My code is correctly setting my clocks according to whether or not it is DST (summer time) but I have yet to determine how my code can know what time of the year it is.

The CLKMGR_IS_DAYLIGHTSAVINGS_ON() function tells me the mode I have set, and the
CLKMGR_GET_DAYLIGHTSAVINGS_OFFSET() function tells me 1:00:00 (one hour) for the amount that DST will change the time.

The simplest way I can think of is to set the Daylight Savings mode to OFF, check the time, then set it back to On and compare the two numbers.

Does anyone have a better way?

Comments

  • a_riot42a_riot42 Posts: 1,624
    Sharpdog wrote: »
    Does anyone have a better way?

    If you are using i!-TimeManager, channel 3 indicates if DST is active.
    Paul
  • Daylight saving

    Enter the dates in the webinterface of the AMX NI-xxxx.
    Daylight saving is supported by the firmware.

    Switch from winter to summertime:
    @ the last sundaymorning in march. The time will be changed from 02:00 to 03:00

    Switch from summer to wintertime:
    @ the last sundaymorning in october. The time will be chanched from 03:00 to 02:00

    thats it.
  • annuelloannuello Posts: 294
    a_riot42 wrote: »
    If you are using i!-TimeManager, channel 3 indicates if DST is active.
    Paul

    It would be great if we could have this feature in RMS. I dropped i!-TM once we moved to RMS, since RMS looked after the time syncing. I would find such a DTS on/off flag quite useful.

    Roger McLean
    Swinburne University
  • viningvining Posts: 4,368
    annuello wrote: »
    It would be great if we could have this feature in RMS. I dropped i!-TM once we moved to RMS, since RMS looked after the time syncing. I would find such a DTS on/off flag quite useful.

    Roger McLean
    Swinburne University
    In the link below there's a function that tracks the DST state. You can use the entire include file or just cannibilize any parts that come in handy.
    http://www.amxforums.com/showthread.php?7543-Run-daily-at-specific-time&post=#7
  • truetrue Posts: 307
    unixtime.axi in the NetLinx Common Libraries has a 'clkmgr_is_daylightsavings_active()' function that returns true if DST is on. It works with the existing clkmgr so only works on firmwares that have support for it. It is incomplete - it only works with occurrence-type and not fixed days right now, and assumes DST starts at midnight, not at the specified time. Usage is as simple as including unixtime.axi and using the function. If you don't have any tasks that need to run during early morning hours on DST change days it works well enough. It'll be completed at some point. :)
Sign In or Register to comment.