httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <stodd...@raleigh.ibm.com>
Subject Re: ap_current_time() is not intuitive
Date Thu, 06 Jan 2000 03:59:04 GMT
> Basically, the ap_time_t structure will remain the same, on Unix:
>     struct timeval   /* I need to remember why I didn't use time_t, but I
>                         think it had to do with some of the current Apache
>                         functions. */
>     struct tm;
> When we get the current time, we will fill out the struct timeval. When we
> explode it, we fill out the struct tm with either localtime or gmtime.
>
> On Windows:
>     time_t
>     SYSTEMTIME
>
I'd prefer to make time_t FILETIME rather than SYSTEMTIME. It's a bit more
convenient and most accurate of the different representations.  And I'd like
atime_t on Win32 have the following fields:

struct atime_t {
    ap_context_t cont;
    FILETIME filetime; /* number of 100nS increments since 1/1/1601 */
    SYSTEMTIME *explodedtime;
    ap_int64_t  unixtime;  /* time in seconds since 1/1/70 */
}

ap_current_time would initialise the FILETIME (via
GetSystemTimeAsFileTime())

> When we get the current time, we fill out the SYSTEMTIME, when we implode
> it, we will convert it to an ansi time.
>
> >
> > i think we should take another hint from NSPR here (see
> > http://www.mozilla.org/docs/refList/refNSPR/prtime.html), and we should
> > have:
> >
> >   /* microseconds since the epoch (00:00:00 jan 1, 1970 UTC) */
> >   typedef ap_int64_t ap_time_t;
> >
> > and
> >
> >   /* "exploded time" ... or use another name for it */
> >   struct ap_tm ap_tm_t;
> >
> > the exploded time is really only for human consumption, it shouldn't be
> > the default returned by functions such as "time(0)" or whatever the "get
> > the time now" function happens to be.  that's far too much computation
for
> > such a commonly used function.
>
> Could you please tell Microsoft that, because the only function I have
> found to do get the current time on a system is GetSystemTime, and that
> returns the equivalent of an expanded time on Windows.
Bzzzzt, Wrong.  See above.

______________________________________________
Bill Stoddard

Come to the first official Apache Software Foundation
Conference!  <http://ApacheCon.Com/>



Mime
View raw message