You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@locus.apache.org on 2000/06/08 01:23:52 UTC

cvs commit: apache-2.0/src/lib/apr/time/unix time.c

rbb         00/06/07 16:23:52

  Modified:    src/lib/apr/include apr_time.h
               src/lib/apr/time/unix time.c
  Log:
  Add a new ap_sleep function for apr.  This basically sleeps for a specified
  number of microseconds.
  
  Revision  Changes    Path
  1.21      +14 -0     apache-2.0/src/lib/apr/include/apr_time.h
  
  Index: apr_time.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- apr_time.h	2000/05/28 02:47:09	1.20
  +++ apr_time.h	2000/06/07 23:23:50	1.21
  @@ -163,6 +163,20 @@
    */
   ap_status_t ap_implode_time(ap_time_t *result, ap_exploded_time_t *input);
   
  +/*
  +
  +=head1 void ap_sleep(ap_time_t t)
  +
  +B<Sleep for the specified number of micro-seconds.>
  +
  +    arg 1) desired amount of time to sleep.
  +
  +B<NOTE>:  May sleep for longer than the specified time. 
  +
  +=cut
  + */
  +void ap_sleep(ap_time_t t);
  +
   /* ap_rfc822_date formats dates in the RFC822
      format in an efficient manner.  it is a fixed length
      format and requires the indicated amount of storage
  
  
  
  1.26      +7 -1      apache-2.0/src/lib/apr/time/unix/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/time/unix/time.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- time.c	2000/06/07 22:32:51	1.25
  +++ time.c	2000/06/07 23:23:51	1.26
  @@ -247,7 +247,13 @@
       return APR_SUCCESS;
   }
   
  -
  +void ap_sleep(ap_time_t t)
  +{
  +    struct timeval tv;
  +    tv.tv_usec = t % AP_USEC_PER_SEC;
  +    tv.tv_sec = t / AP_USEC_PER_SEC;
  +    select(0, NULL, NULL, NULL, &tv);
  +}
   
   #ifdef OS2
   #define INCL_DOS
  
  
  

Re: ap_interval_time_t (was: Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c)

Posted by rb...@covalent.net.
> > I guess I see reasoning behind it, I just don't see the need.  Since
> > people seem to like it, I'm not complaining, I am just going to have to be
> > reminded that we need to do this, because it isn't something I am likely
> > to think of on my own.  :-)
> 
> I'm with Dean on the need for two. But no worries Ryan: I'm always willing
> to pester^H^H^H^H^H^Hremind you about the other type.
> 
> p.s. note that it has been switched to an ap_interval_time_t, and the one
> call in Apache that used it has also been updated.

I don't mind making the changes (as I did in this case), I'm just not
likely to do it correctly the first time until I get used to it.  :-)

And I'm likely to fight getting used to it every step of the way.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


ap_interval_time_t (was: Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c)

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Jun 09, 2000 at 02:25:39PM -0700, rbb@covalent.net wrote:
> 
> > > > shouldn't that be ap_interval_time_t?
> > > 
> > > Probably, but I still don't see the need for the two types, so I
> > > constantly forget about the interval_time.  I'll change it later.
> > 
> > dunno if i can help:  ap_time_t is an absolute time.  semantically it
> > doesn't make sense to store a 5 millisecond interval in an absolute time
> > (because the value "5 ms" means "5 ms after the epoch").  abs time needs
> > 64-bits, and relative time needs only 32-bits ...
> 
> I guess I see reasoning behind it, I just don't see the need.  Since
> people seem to like it, I'm not complaining, I am just going to have to be
> reminded that we need to do this, because it isn't something I am likely
> to think of on my own.  :-)

I'm with Dean on the need for two. But no worries Ryan: I'm always willing
to pester^H^H^H^H^H^Hremind you about the other type.

:-)

Cheers,
-g

p.s. note that it has been switched to an ap_interval_time_t, and the one
call in Apache that used it has also been updated.

-- 
Greg Stein, http://www.lyra.org/

Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by rb...@covalent.net.
> > > shouldn't that be ap_interval_time_t?
> > 
> > Probably, but I still don't see the need for the two types, so I
> > constantly forget about the interval_time.  I'll change it later.
> 
> dunno if i can help:  ap_time_t is an absolute time.  semantically it
> doesn't make sense to store a 5 millisecond interval in an absolute time
> (because the value "5 ms" means "5 ms after the epoch").  abs time needs
> 64-bits, and relative time needs only 32-bits ...

I guess I see reasoning behind it, I just don't see the need.  Since
people seem to like it, I'm not complaining, I am just going to have to be
reminded that we need to do this, because it isn't something I am likely
to think of on my own.  :-)

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by dean gaudet <dg...@arctic.org>.
On Wed, 7 Jun 2000 rbb@covalent.net wrote:

> > >   Add a new ap_sleep function for apr.  This basically sleeps for a specified
> > >   number of microseconds.
> > >   
> > >   +/*
> > >   +
> > >   +=head1 void ap_sleep(ap_time_t t)
> > 
> > shouldn't that be ap_interval_time_t?
> 
> Probably, but I still don't see the need for the two types, so I
> constantly forget about the interval_time.  I'll change it later.

dunno if i can help:  ap_time_t is an absolute time.  semantically it
doesn't make sense to store a 5 millisecond interval in an absolute time
(because the value "5 ms" means "5 ms after the epoch").  abs time needs
64-bits, and relative time needs only 32-bits ...

-dean


Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by rb...@covalent.net.
> >   Add a new ap_sleep function for apr.  This basically sleeps for a specified
> >   number of microseconds.
> >   
> >   +/*
> >   +
> >   +=head1 void ap_sleep(ap_time_t t)
> 
> shouldn't that be ap_interval_time_t?

Probably, but I still don't see the need for the two types, so I
constantly forget about the interval_time.  I'll change it later.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by rb...@covalent.net.
> >   Add a new ap_sleep function for apr.  This basically sleeps for a specified
> >   number of microseconds.
> >   
> >   +/*
> >   +
> >   +=head1 void ap_sleep(ap_time_t t)
> 
> shouldn't that be ap_interval_time_t?

Probably, but I still don't see the need for the two types, so I
constantly forget about the interval_time.  I'll change it later.

Ryan

_______________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
406 29th St.
San Francisco, CA 94131
-------------------------------------------------------------------------------


Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
> From: rbb@locus.apache.org
> Date: 7 Jun 2000 23:23:52 -0000
> 
> rbb         00/06/07 16:23:52
> 
>   Modified:    src/lib/apr/include apr_time.h
>                src/lib/apr/time/unix time.c
>   Log:
>   Add a new ap_sleep function for apr.  This basically sleeps for a specified
>   number of microseconds.
>   
>   +/*
>   +
>   +=head1 void ap_sleep(ap_time_t t)

shouldn't that be ap_interval_time_t?

>   +
>   +B<Sleep for the specified number of micro-seconds.>
>   +
>   +    arg 1) desired amount of time to sleep.
>   +
>   +B<NOTE>:  May sleep for longer than the specified time. 
>   +
>   +=cut
>   + */
>   +void ap_sleep(ap_time_t t);
>   +


-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Re: cvs commit: apache-2.0/src/lib/apr/time/unix time.c

Posted by Jeff Trawick <tr...@bellsouth.net>.
> From: rbb@locus.apache.org
> Date: 7 Jun 2000 23:23:52 -0000
> 
> rbb         00/06/07 16:23:52
> 
>   Modified:    src/lib/apr/include apr_time.h
>                src/lib/apr/time/unix time.c
>   Log:
>   Add a new ap_sleep function for apr.  This basically sleeps for a specified
>   number of microseconds.
>   
>   +/*
>   +
>   +=head1 void ap_sleep(ap_time_t t)

shouldn't that be ap_interval_time_t?

>   +
>   +B<Sleep for the specified number of micro-seconds.>
>   +
>   +    arg 1) desired amount of time to sleep.
>   +
>   +B<NOTE>:  May sleep for longer than the specified time. 
>   +
>   +=cut
>   + */
>   +void ap_sleep(ap_time_t t);
>   +


-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...