apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject cvs commit: apr/time/win32 time.c
Date Sat, 30 Jun 2001 09:50:31 GMT
brane       01/06/30 02:50:31

  Modified:    include  apr_time.h
               test     testtime.c
               time/unix time.c
               time/win32 time.c
  Log:
  Added new function apr_implode_gmt, which works like apr_implode_time, except
  that it always produces an apr_time_t that represents GMT.
  
  * include/apr_time.h (apr_implode_gmt): New function.
  * time/unix/time.c, time/win32/time.c: Implement it.
  * test/testtime.c: Test it. The test is analogous to the apr_implode_time test.
  
  Revision  Changes    Path
  1.40      +10 -0     apr/include/apr_time.h
  
  Index: apr_time.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_time.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- apr_time.h	2001/06/09 06:54:33	1.39
  +++ apr_time.h	2001/06/30 09:50:27	1.40
  @@ -176,6 +176,16 @@
                                              apr_exploded_time_t *input);
   
   /**
  + * Convert time value from human readable format to a numeric apr_time_t that
  + * always represents GMT
  + * @param result the resulting imploded time
  + * @param input the input exploded time
  + * @deffunc apr_status_t apr_implode_gmt(apr_time_t *result, apr_exploded_time_t *input)
  + */
  +APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *result, 
  +                                          apr_exploded_time_t *input);
  +
  +/**
    * Sleep for the specified number of micro-seconds.
    * @param t desired amount of time to sleep.
    * @deffunc void apr_sleep(apr_interval_time_t t)
  
  
  
  1.23      +15 -0     apr/test/testtime.c
  
  Index: testtime.c
  ===================================================================
  RCS file: /home/cvs/apr/test/testtime.c,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- testtime.c	2001/06/29 08:23:15	1.22
  +++ testtime.c	2001/06/30 09:50:29	1.23
  @@ -99,6 +99,21 @@
       }
       printf("OK\n");
   
  +    STD_TEST_NEQ("    apr_implode_gmt (localtime)",
  +                 apr_implode_gmt(&imp, &xt2))
  +
  +    printf("%-60s", "    checking localtime explode == GMT implode");
  +    if (imp != now) {
  +	printf("mismatch\n"
  +                "\t\tapr_now()                %" APR_INT64_T_FMT "\n"
  +                "\t\tapr_implode() returned   %" APR_INT64_T_FMT "\n"
  +                "\t\terror delta was          %" APR_TIME_T_FMT "\n"
  +                "\t\tshould have been         0\n",
  +                now, imp, imp-now);
  +	exit(-1);
  +    }
  +    printf("OK\n");
  +
       str = apr_pcalloc(p, sizeof(char) * STR_SIZE);
       str2 = apr_pcalloc(p, sizeof(char) * STR_SIZE);
       imp = 0;
  
  
  
  1.48      +8 -0      apr/time/unix/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apr/time/unix/time.c,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- time.c	2001/06/29 12:17:40	1.47
  +++ time.c	2001/06/30 09:50:29	1.48
  @@ -193,6 +193,14 @@
       return APR_SUCCESS;
   }
   
  +apr_status_t apr_implode_gmt(apr_time_t *t, apr_exploded_time_t *xt)
  +{
  +    apr_status_t status = apr_implode_time(t, xt);
  +    if (status == APR_SUCCESS)
  +        *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC;
  +    return status;
  +}
  +
   apr_status_t apr_os_imp_time_get(apr_os_imp_time_t **ostime, apr_time_t *aprtime)
   {
       (*ostime)->tv_usec = *aprtime % APR_USEC_PER_SEC;
  
  
  
  1.24      +9 -0      apr/time/win32/time.c
  
  Index: time.c
  ===================================================================
  RCS file: /home/cvs/apr/time/win32/time.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- time.c	2001/06/06 18:59:25	1.23
  +++ time.c	2001/06/30 09:50:30	1.24
  @@ -210,6 +210,15 @@
       return APR_SUCCESS;
   }
   
  +APR_DECLARE(apr_status_t) apr_implode_gmt(apr_time_t *t,
  +                                          apr_exploded_time_t *xt)
  +{
  +    apr_status_t status = apr_implode_time(t, xt);
  +    if (status == APR_SUCCESS)
  +        *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC;
  +    return status;
  +}
  +
   APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime,
                                                 apr_time_t *aprtime)
   {
  
  
  

Mime
View raw message