Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 9009 invoked by uid 6000); 3 Jan 2000 19:55:54 -0000 Received: (qmail 8985 invoked from network); 3 Jan 2000 19:55:52 -0000 Received: from smtp.ntrnet.net (206.66.160.16) by taz.hyperreal.org with SMTP; 3 Jan 2000 19:55:52 -0000 Received: from mail.ntrnet.net (mail.ntrnet.net [206.66.160.4]) by smtp.ntrnet.net (Postfix) with ESMTP id 4E81F1F03C for ; Mon, 3 Jan 2000 14:55:50 -0500 (EST) Received: from shell.ntrnet.net (squid.ntrnet.net [206.66.160.7]) by mail.ntrnet.net (Postfix) with ESMTP id 1FE8376806 for ; Mon, 3 Jan 2000 14:55:49 -0500 (EST) Received: (from rbb@localhost) by shell.ntrnet.net (8.8.5/8.8.5) id OAA18536; Mon, 3 Jan 2000 14:55:49 -0500 Date: Mon, 3 Jan 2000 14:55:49 -0500 (EST) From: rbb@apache.org X-Sender: rbb@shell.ntrnet.net To: new-httpd@apache.org Subject: Re: ap_current_time() is not intuitive In-Reply-To: <005701bf5617$03680b10$064b2509@raleigh.ibm.com> Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org Status: O 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. -------------------------------------------------------------------------------