Ciao,

Here's some feedback on the interface...
I'd definitely add a Set method from a time_t value. Personally, I might
add a constructor from a tm struct for completeness, but it's not a big
deal. (In theory, with this class, we'd never see the struct tm in our code
since the class would deal with that.)

>I've placed a switch "local_time" in the class to permit the conversion
>from a time_t value into a localtime value or a gm value expressed by a
>struct tm.

        void SwitchOnLocalTime() {local_time=true;}
        void SwitchOffLocalTime() {local_time=false;}
        void SwitchOnGMTime() {local_time=false;}
        void SwitchOffGMTime() {local_time=true;}

Personally, I'd change this to something like LocalToGM and GMToLocal that
switched the local_time *and* did the conversion. Having these methods
seems a bit dangerous. How does one "switch off" a timezone? Does it make
sense to call
   SwitchOffLocalTime();
   SwitchOffGMTime();
or
   SwitchOffLocalTime();
   SwitchOnGMTime();
In user code, the first is doesn't make sense but it's possible. The second
is redundant but possible.

>I also placed 3 methods for showing the date in asctime, RFC1123 and RFC850
>that are the ones supported by HTTP/1.1.

ISO-8601 would be another good format: YYYY-MM-DD and YYYY-MM-DD HH:MM:SS
TZ (%Y-%m-%d %H:%M:%S %Z).

I'd also add in something like GetTimeDefault which would use the default
date format for the locale, e.g. %x or %c... We use %x in the Display.cc
code.

>I want to understand how mytimegm and Htstrptime work. I think, if you
>agree, they could be inserted into the class.

These *should* now be both called Httimegm and Htstrptime. They're merely
replacements for (possibly) broken system versions of timegm() and
strptime(). The former converts a tm structure into a time_t (in UTC) and
the latter converts a string into a tm structure:

char *strptime(char *buf, const char *format, const struct
       tm *tm)
time_t Httimegm(tm *time)

-Geoff


------------------------------------
To unsubscribe from the htdig3-dev mailing list, send a message to
[EMAIL PROTECTED] containing the single word "unsubscribe" in
the SUBJECT of the message.

Reply via email to