httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject Re: ap_current_time() is not intuitive
Date Mon, 03 Jan 2000 19:55:49 GMT
On Mon, 3 Jan 2000, Bill Stoddard wrote:

> Can we collapse the ap_current_time() function into either ap_make_time or
> ap_get_curtime()? Here is how you use APR to get the current time today:

I take back what I said about collapsing current_time into make_time.
Take a look at where they are used throughout the server.  Most of the
time, we make the time instance, and then fill it in with something from
somewhere else.  This may be because of what the current Apache code has
to deal with, or it may be that this is the way time code just works.  I
think the best way to deal with this, is to re-name the time functions for
now, and see where things go with the time stuff.

I am currently working on getting rid of the stat calls in Apache, by
replacing them with friendlier apr calls that do the same things.  When we
see what the code looks like after we have the stat replacement finished,
I think we will have a better idea of where to go with the time functions.

I really think it would be a mistake to get the current time when we
create the time instance, because we always represent the time in two
forms inside the APR type.  Figuring out which of those two forms is the
one we really care about is hard to do if we always fill out one of them.

Ryan

> 
> ap_make_time(&time, p);
> ap_current_time(time);
> ap_get_curtime(time, &thetime);
> 
> ap_make_time creates the ap_time_t structure. Then ap_current_time() makes
> the underlying system call to initialize the ap_time_t structure. Then
> ap_get_curtime returns the time in seconds since 1/1/1970.  Note that
> ap_get_curtime is not getting the current time, it is getting the time from
> when ap_current_time was called. This is non-intutitive as hell.


_______________________________________________________________________________
Ryan Bloom                        	rbb@ntrnet.net
6209 H Shanda Dr.
Raleigh, NC 27609		Ryan Bloom -- thinker, adventurer, artist,
				     writer, but mostly, friend.
-------------------------------------------------------------------------------


Mime
View raw message