Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] To kill an application

Expand Messages
  • erik.tank@bpxinternet.com
    You can use localtime: ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime; localtime return the current time as a list. So to figure out a time
    Message 1 of 4 , Jul 5, 2001
    • 0 Attachment
      You can use localtime:
      ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
      localtime return the current time as a list.

      So to figure out a time lapse of 3 seconds you would do something like this:
      my $start_time = localtime[0]; # slice localtime and only return the 1st
      element which is seconds

      while ( localtime[0] - $start_time < 3 ) {
      #do something here
      }

      Of course you will have to add some code to deal with the situation when you
      start at 59 seconds.

      However if you don't what to do anything and long wait/delay the execution
      of the program for n seconds the you can just use: sleep n. Where n is the
      number of seconds you want to wait.

      Hope that helps,

      Erik Tank
      602-817-4705
      erik.tank@...


      -----Original Message-----
      From: jaya kumaran [mailto:teddy@...]
      Sent: Wednesday, July 04, 2001 11:05 PM
      To: perl-beginner@yahoogroups.com
      Subject: [PBML] To kill an application


      hi, I have a c file - test.c with the following instrunction # include
      <stdio.h> main() { int i; for(; ;) printf("hello
      world"); } here a.out wiil display the "Hello world" infinetly.
      i need to kill the process a.out after a particular time eg, 3 seconds. how
      to achieve this?? Is it possible using perl. Any suggestion Thanks in
      advance, jaya

      _____________________________________________________________
      Get Free Fast Easy email from indiya.com: SIGNUP NOW : http://www.indiya.com



      Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    • obrienta@iserv.net
      sounds expensive! sleep is a built in function and works like: sleep(3); # Sleep for 3 seconds Tommy O
      Message 2 of 4 , Jul 5, 2001
      • 0 Attachment
        sounds expensive! sleep is a built in function and works like:

        sleep(3); # Sleep for 3 seconds

        Tommy O

        --- In perl-beginner@y..., erik.tank@b... wrote:
        > You can use localtime:
        > ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime;
        > localtime return the current time as a list.
        >
        > So to figure out a time lapse of 3 seconds you would do something like this:
        > my $start_time = localtime[0]; # slice localtime and only return the 1st
        > element which is seconds
        >
        > while ( localtime[0] - $start_time < 3 ) {
        > #do something here
        > }
        >
        > Of course you will have to add some code to deal with the situation when you
        > start at 59 seconds.
        >
        > However if you don't what to do anything and long wait/delay the execution
        > of the program for n seconds the you can just use: sleep n. Where n is the
        > number of seconds you want to wait.
        >
        > Hope that helps,
        >
        > Erik Tank
        > 602-817-4705
        > erik.tank@b...
        >
        >
        > -----Original Message-----
        > From: jaya kumaran [mailto:teddy@i...]
        > Sent: Wednesday, July 04, 2001 11:05 PM
        > To: perl-beginner@y...
        > Subject: [PBML] To kill an application
        >
        >
        > hi, I have a c file - test.c with the following instrunction # include
        > <stdio.h> main() { int i; for(; ;) printf("hello
        > world"); } here a.out wiil display the "Hello world" infinetly.
        > i need to kill the process a.out after a particular time eg, 3 seconds. how
        > to achieve this?? Is it possible using perl. Any suggestion Thanks in
        > advance, jaya
        >
        > _____________________________________________________________
        > Get Free Fast Easy email from indiya.com: SIGNUP NOW : http://www.indiya.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      Your message has been successfully submitted and would be delivered to recipients shortly.