httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <>
Subject Re: ap_current_time() is not intuitive
Date Thu, 06 Jan 2000 19:40:51 GMT
On Thu, 6 Jan 2000, Ryan Bloom wrote:
> On Thu, 6 Jan 2000, Bill Stoddard wrote:
> > > Having both a FILETIME and storing a unixtime is IMHO a very bad idea.
> > > Because you will never know if somebody stored a value in the FILETIME
> > > when you go to retrieve the unixtime, you will always have to convert from
> > > FILETIME to unixtime
> > The canonical representation is FILETIME, so it should always be present.
> > The first time you request unixtime (or whatever we name it), you compute it
> > from FILETIME. Subsequent requests fetch what is already there. Same with
> > exploded time.
> And hence the bug.  I get the currenttime, which is stored as a FILETIME.
> I then ask for the unixtime, and that value is stored.  Next, I insert a
> new FILETIME, but asking for the current time again, or by inserting it
> with ap_put_os_time.  The next time I ask for the unixtime, I will get the
> original time, which is wrong.  Take a look at the function which does the
> conversion, it is some bit shifting, a simple bitwise or, and some
> subtracting.  It just isn't slow enough to not call whenever we want the
> unixtime.

Then make sure to clear the bit whenever a new FILETIME is stored. That
bug does not invalidate the basic premise that FILETIME is the "proper"
base format.

+1 to use FILETIME for the authoritative time format (and derive other
formats from that).


-Greg "Looking forward to 2038" Stein  :-)

Greg Stein,

View raw message