nukhanpk1

updated

9 years ago

N

nukhanpk1

14 Posts

0

4907

May 29th, 2017 01:00

How to compare two time values in asl script

Hi,

Any body can guide how two values of time can be compared using ASL script I have used this code but somehow its not working

if(time() > time(1496061600)){

print(time()." Is Greater than ".time(1496061600));}

I have tried this comparison in different ways by even converting it to numeric value but it is not working.

  • 2756

    0

    Posted July 4th, 2017 02:00

    START {

    .. eol

    }

    do {

    p = time();

    r = numeric(p);

    q = time(1496061600);

    //print(p);

    //print(q);

    //print("the numeric time for Today is ".r);

    if (r > q){

    print(r."value is greater than".q);

    }

    }

    output:

    1499161207value is greater than1496061600

  • SeanPopham

    54 Posts

    2756

    0

    Posted June 27th, 2017 15:00

    Thank you for contacting the Dell EMC Community Network.

    That is a great question and I'm researching your issue and will followup with you on Thursday.

    Kind Regards,


    Sean

  • 2756

    0

    Posted June 27th, 2017 21:00

    Superbly insufficient setup, background and purpose in relationship to the issue submitted as a question. 

  • SeanPopham

    54 Posts

    2756

    0

    Posted June 29th, 2017 09:00

    Nukhanpk,

    Can you try the following:

    START { } do {

    if (time() > time(1496061345)) {

    print(time()." Is Greater than ".time(1496061345));

    }

    stop();

    }

    just create local/rules/test_time.asl and add the above, then run with sm_adatper test_time.asl



    Please let me know if this helps.


  • nukhanpk1

    14 Posts

    2756

    0

    Posted June 30th, 2017 01:00

    Dear Sean,

    I have executed the script and following is the error output for your reference:

    [June 30, 2017 12:15:28 PM GMT+05:00 +344ms] t@978790176 adapter

    ASL-E-ERROR_RULE_INIT-While initializing rule set

    ASL-ERROR_FILE_PARSE-While parsing rules in file 'test_time.asl'

    ASL-ERROR_NO_START-Start rule is missing

    [June 30, 2017 12:15:28 PM GMT+05:00 +360ms] t@978790176 adapter

    SVIF-N-SHUTDOWN-Shutting down...

  • nukhanpk1

    14 Posts

    2756

    0

    Posted July 1st, 2017 23:00

    Dear Lisa,

    Smarts version 9.2.4 is being used here and I am using this logic actually to restrict email adapter to send emails based of specific time value (say only between 9:00 am to 06:00 pm). I used other logics in the ASL script by using different classes and their values and it working fine but some how time values and their comparison is not working.

    following is the ASL script which i am using for test with sm_adapter.


    START { } do {

    //comparing June 30, 2017 12:15:28 PM GMT+05:00 +344ms with 09:00 am

    if (time() > time(1498813200)) {

    print(time()." Is Greater than ".time(1498813200));

    }

    stop();

    }

    after executing I receive following error:

    [June 30, 2017 12:15:28 PM GMT+05:00 +344ms] t@978790176 adapter

    ASL-E-ERROR_RULE_INIT-While initializing rule set

    ASL-ERROR_FILE_PARSE-While parsing rules in file 'test_time.asl'

    ASL-ERROR_NO_START-Start rule is missing

    [June 30, 2017 12:15:28 PM GMT+05:00 +360ms] t@978790176 adapter

    SVIF-N-SHUTDOWN-Shutting down...

  • 2756

    0

    Posted July 2nd, 2017 13:00

    Hi Lisa.  Hope you are well.  Happy 4th of July!

    Dave Redwine

  • SeanPopham

    54 Posts

    1799

    0

    Posted July 7th, 2017 08:00

    Nukhanpk,


    Just asking if any of the provided answers have resolved your issue?


    Please let me know.


    Kind Regards,


    Sean

  • 1085

    0

    Posted July 7th, 2017 08:00

    Hii sean,

    Yes, It had resolved our issue.

  • nukhanpk1

    14 Posts

    2042

    0

    Posted July 17th, 2017 00:00

    Dear Prashanth,

            Thanks for your solution its working perfectly, can you help me to make it more better as I want to compare value of current time in numeric with the value of some specific time value of same day. I mean its actually a mail adapter which I am customizing to stop email sending if time is more than 18:00 hours of the same day when mail is being sent.

    In a nutshell is there any way to convert  say [ July 18, 2017 4:00:00 AM GMT+05:00] to numeric in order to compare it with the numeric value current time stamp (numeric(time())).