Ciao, here we are at HtDateTime class take 3.

I've solved gmtime problem.

To store the datetime from a tm structure, I use this method.
If I want to store it in a localtime way, I invoke ToLocalTime() method
(and so mktime). Else, I invoke ToGMTime() and then timegm.

void HtDateTime::SetDateTime(struct tm *ptm)
{

   if(local_time)
         Ht_t = mktime(ptm);    // Invoke mktime
   else
         Ht_t = Httimegm(ptm);  // Invoke timegm alike function
   
}

How about including mytimegm and other function inside the class? Please
reply!

Let me know

Ciao
-Gabriele

Here are the tests I made ...

============

TEST 1

Beginning Test of a personal format such as %Y.%m.%d %H:%M:%S

         1      Date string parsing of:
                1970.01.01 00:00:00
                using format: %Y.%m.%d %H:%M:%S


           Localtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 01:00:00 CET
                 RFC 850 Format  : Thursday, 01-Jan-70 01:00:00 CET
                 C Asctime Format: Thu Jan  1 01:00:00 1970
                 ISO 8601 Format : 1970-01-01 01:00:00 CET

           GMtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 00:00:00 GMT
                 RFC 850 Format  : Thursday, 01-Jan-70 00:00:00 GMT
                 C Asctime Format: Thu Jan  1 00:00:00 1970
                 ISO 8601 Format : 1970-01-01 00:00:00 GMT

         2      Date string parsing of:
                1970.01.01 00:00:01
                using format: %Y.%m.%d %H:%M:%S


           Localtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 01:00:01 CET
                 RFC 850 Format  : Thursday, 01-Jan-70 01:00:01 CET
                 C Asctime Format: Thu Jan  1 01:00:01 1970
                 ISO 8601 Format : 1970-01-01 01:00:01 CET

           GMtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 00:00:01 GMT
                 RFC 850 Format  : Thursday, 01-Jan-70 00:00:01 GMT
                 C Asctime Format: Thu Jan  1 00:00:01 1970
                 ISO 8601 Format : 1970-01-01 00:00:01 GMT

 continue ...


============

TEST 2

Beginning Test of ISO 8601 format

         1      Date string parsing of:
                1970-01-01 00:00:00 GMT
                using format: %Y-%m-%d %H:%M:%S %Z


           Localtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 01:00:00 CET
                 RFC 850 Format  : Thursday, 01-Jan-70 01:00:00 CET
                 C Asctime Format: Thu Jan  1 01:00:00 1970
                 ISO 8601 Format : 1970-01-01 01:00:00 CET

           GMtime viewing
                 RFC 1123 Format : Thu, 01 Jan 1970 00:00:00 GMT
                 RFC 850 Format  : Thursday, 01-Jan-70 00:00:00 GMT
                 C Asctime Format: Thu Jan  1 00:00:00 1970
                 ISO 8601 Format : 1970-01-01 00:00:00 GMT

continue ...


============

TEST 3

Beginning Test of RFC 1123 format

         1      Date string parsing of:
                Sun, 06 Nov 1994 08:49:37 GMT
                using format: %a, %d %b %Y %H:%M:%S %Z


           Localtime viewing
                 RFC 1123 Format : Sun, 06 Nov 1994 09:49:37 CET
                 RFC 850 Format  : Sunday, 06-Nov-94 09:49:37 CET
                 C Asctime Format: Sun Nov  6 09:49:37 1994
                 ISO 8601 Format : 1994-11-06 09:49:37 CET

           GMtime viewing
                 RFC 1123 Format : Sun, 06 Nov 1994 08:49:37 GMT
                 RFC 850 Format  : Sunday, 06-Nov-94 08:49:37 GMT
                 C Asctime Format: Sun Nov  6 08:49:37 1994
                 ISO 8601 Format : 1994-11-06 08:49:37 GMT


...

HtDateTime.zip



-------------------------------------------------

Gabriele Bartolini
U.O. Rete Civica - Comune di Prato
Prato - Italia - Europa

e-mail: [EMAIL PROTECTED]
http://www.po-net.prato.it

-------------------------------------------------

Reply via email to