Highlighted
nukhanpk1
1 Copper

How to compare two time values in asl script

Jump to solution

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.

Labels (1)
0 Kudos
1 Solution

Accepted Solutions

Re: How to compare two time values in asl script

Jump to solution

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

0 Kudos
18 Replies
SeanPopham
2 Iron

Re: How to compare two time values in asl script

Jump to solution

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

0 Kudos
DiamondCloud
1 Copper

Re: How to compare two time values in asl script

Jump to solution

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

0 Kudos
SeanPopham
2 Iron

Re: How to compare two time values in asl script

Jump to solution

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.


0 Kudos
nukhanpk1
1 Copper

Re: How to compare two time values in asl script

Jump to solution

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...

0 Kudos
LisaPorter
1 Copper

Re: How to compare two time values in asl script

Jump to solution

Hello Nukhanpk,

The provided script works in Dell-EMC labs. Could you verify what command you are using to run the script and also upload the script from your environment to the post to be validated. 

nukhanpk1
1 Copper

Re: How to compare two time values in asl script

Jump to solution

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...

0 Kudos
DiamondCloud
1 Copper

Re: How to compare two time values in asl script

Jump to solution

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

Dave Redwine

0 Kudos

Re: How to compare two time values in asl script

Jump to solution

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

0 Kudos
SeanPopham
2 Iron

Re: How to compare two time values in asl script

Jump to solution

Nukhanpk,


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


Please let me know.


Kind Regards,


Sean

0 Kudos