Using a SPECTRUM Event Procedure to assert event based on time
search cancel

Using a SPECTRUM Event Procedure to assert event based on time

book

Article ID: 51985

calendar_today

Updated On:

Products

CA Spectrum

Issue/Introduction

Using a SPECTRUM Event Procedure to assert event based on time

Environment

Release: Any
Component:

Resolution

The following is a sample Event Procedure that will check the current time when event 0xffff0000 is asserted. If the time is between 8:00 AM and 5:00 PM (0800 - 1700), event 0xffff0001 will be created. If not, event 0xffff0002 will be created. The times use the 24 hour clock time and can be changed to meet individual needs.

 

0xffff0000 P " \
  If( \
    And ( \
        GreaterOrEqual( GetHour( GetCurrentTime() ), \
                                 { U 8 } ),                     \
        LessOrEqual( GetHour( GetCurrentTime() ),    \
                                { U 17 } ) ),                   \
    CreateEvent( { C CURRENT_MODEL },       \
                       { H 0xffff0001 } ),                   \
    CreateEvent( { C CURRENT_MODEL },      \
                       { H 0xfffff0002 } )"


In the above example, no additional varbinds are in these events. You would have to use CreateEventWithAttributes() if you want some varbinds as well, and supply a third parameter  (e.g. GetEventAttributeList() to get a copy of the current event?s varbind values.