]> granicus.if.org Git - apache/commitdiff
Remove a bunch of functions that are being replaced by functions in APR.
authorRyan Bloom <rbb@apache.org>
Tue, 21 Dec 1999 21:41:53 +0000 (21:41 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 21 Dec 1999 21:41:53 +0000 (21:41 +0000)
Also finished porting Apache to use APR in most cases.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84355 13f79535-47bb-0310-9956-ffa450edef68

configure.in
include/httpd.h
include/util_date.h
modules/loggers/mod_log_config.c
server/util.c
server/util_date.c

index 13765c7c2a73ef5e2fc7e4fb1a3309c01bbb3a20..58205e3aa0fa1a870b80678f41675d81e3751422 100644 (file)
@@ -83,7 +83,6 @@ strstr \
 strerror \
 initgroups \
 waitpid \
-difftime \
 gettimeofday \
 memmove \
 bzero \
index 7f39de0a3a701f1966bef424b553c5db6a0a706d..5a1cb04555593d75c1e85e298634205090632a97 100644 (file)
@@ -914,7 +914,6 @@ struct server_rec {
  */
 
 /* Time */
-API_EXPORT(struct tm *) ap_get_gmtoff(int *tz);
 API_EXPORT(char *) ap_get_time(void);
 API_EXPORT(char *) ap_field_noparam(ap_context_t *p, const char *intype);
 API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, int gmt);
index 0504e5e5fdbad7a0539e154c8571a862c8f27b4c..a11a464fffcbd217813fac62b517cc90d6e18fca 100644 (file)
@@ -76,7 +76,6 @@ extern "C" {
 #define BAD_DATE (time_t)0
 
 API_EXPORT(int) ap_checkmask(const char *data, const char *mask);
-API_EXPORT(time_t) ap_tm2sec(const struct tm *t);
 API_EXPORT(ap_time_t *) ap_parseHTTPdate(const char *date, ap_context_t *cont);
 
 #ifdef __cplusplus
index 7debb7977ef1f8d32017a94302a6832c454a49b2..bc436ebcd4c9b28d3c87d60f7b13552ee70a1af9 100644 (file)
@@ -381,13 +381,15 @@ static const char *log_env_var(request_rec *r, char *a)
 static const char *log_request_time(request_rec *r, char *a)
 {
     int timz;
-    struct tm *t;
+    ap_int32_t mday, year, hour, min, sec, month;
+    ap_time_t *t;
     char tstr[MAX_STRING_LEN];
 
-    t = ap_get_gmtoff(&timz);
+    ap_make_time(&t, r->pool);
+    ap_get_gmtoff(&timz, t, r->pool);
 
     if (a && *a) {              /* Custom format */
-        strftime(tstr, MAX_STRING_LEN, a, t);
+        ap_strftime(tstr, MAX_STRING_LEN, a, t);
     }
     else {                      /* CLF format */
         char sign = (timz < 0 ? '-' : '+');
@@ -395,9 +397,15 @@ static const char *log_request_time(request_rec *r, char *a)
         if (timz < 0) {
             timz = -timz;
         }
+        ap_get_mday(t, &mday);
+        ap_get_year(t, &year);
+        ap_get_hour(t, &month);
+        ap_get_hour(t, &hour);
+        ap_get_min(t, &min);
+        ap_get_sec(t, &sec);
         ap_snprintf(tstr, sizeof(tstr), "[%02d/%s/%d:%02d:%02d:%02d %c%.2d%.2d]",
-                t->tm_mday, ap_month_snames[t->tm_mon], t->tm_year+1900, 
-                t->tm_hour, t->tm_min, t->tm_sec,
+                mday, ap_month_snames[month], year+1900, 
+                hour, min, sec,
                 sign, timz / 60, timz % 60);
     }
 
index 666d54a6c1bbcac8e361489f044231cdfb8fa835..b63e057889bd399808f50718ba53b87a089f8cea 100644 (file)
@@ -94,12 +94,13 @@ extern int fclose(FILE *);
 
 API_EXPORT(char *) ap_get_time()
 {
-    time_t t;
-    char *time_string;
+    ap_time_t *t = NULL;
+    char *time_string = NULL;
 
-    t = time(NULL);
-    time_string = ctime(&t);
-    time_string[strlen(time_string) - 1] = '\0';
+    ap_make_time(&t, NULL);
+    ap_current_time(t);
+
+    ap_timestr(&time_string, t, APR_LOCALTIME, NULL);
     return (time_string);
 }
 
@@ -174,37 +175,6 @@ API_EXPORT(char *) ap_ht_time(ap_context_t *p, ap_time_t *t, const char *fmt, in
     return ap_pstrdup(p, ts);
 }
 
-/* What a pain in the ass. */
-#if defined(HAVE_GMTOFF)
-API_EXPORT(struct tm *) ap_get_gmtoff(int *tz)
-{
-    time_t tt = time(NULL);
-    struct tm *t;
-
-    t = localtime(&tt);
-    *tz = (int) (t->tm_gmtoff / 60);
-    return t;
-}
-#else
-API_EXPORT(struct tm *) ap_get_gmtoff(int *tz)
-{
-    time_t tt = time(NULL);
-    struct tm gmt;
-    struct tm *t;
-    int days, hours, minutes;
-
-    /* Assume we are never more than 24 hours away. */
-    gmt = *gmtime(&tt);                /* remember gmtime/localtime return ptr to static */
-    t = localtime(&tt);                /* buffer... so be careful */
-    days = t->tm_yday - gmt.tm_yday;
-    hours = ((days < -1 ? 24 : 1 < days ? -24 : days * 24)
-            + t->tm_hour - gmt.tm_hour);
-    minutes = hours * 60 + t->tm_min - gmt.tm_min;
-    *tz = minutes;
-    return t;
-}
-#endif
-
 /* Roy owes Rob beer. */
 /* Rob owes Roy dinner. */
 
@@ -2047,13 +2017,6 @@ char *
 }
 #endif
 
-#ifndef HAVE_DIFFTIME
-double difftime(time_t time1, time_t time0)
-{
-    return (time1 - time0);
-}
-#endif
-
 /* we want to downcase the type/subtype for comparison purposes
  * but nothing else because ;parameter=foo values are case sensitive.
  * XXX: in truth we want to downcase parameter names... but really,
index 78a57af5d4acaaa612ed190d6a44cee2cd14c1b9..ba0251efc735cdf39592c72f8deb4595a55ddf91 100644 (file)
@@ -125,48 +125,6 @@ API_EXPORT(int) ap_checkmask(const char *data, const char *mask)
     return 0;                  /* We only get here if mask is corrupted (exceeds 256) */
 }
 
-/*
- * tm2sec converts a GMT tm structure into the number of seconds since
- * 1st January 1970 UT.  Note that we ignore tm_wday, tm_yday, and tm_dst.
- * 
- * The return value is always a valid time_t value -- (time_t)0 is returned
- * if the input date is outside that capable of being represented by time(),
- * i.e., before Thu, 01 Jan 1970 00:00:00 for all systems and 
- * beyond 2038 for 32bit systems.
- *
- * This routine is intended to be very fast, much faster than mktime().
- */
-API_EXPORT(time_t) ap_tm2sec(const struct tm * t)
-{
-    int year;
-    time_t days;
-    static const int dayoffset[12] =
-    {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275};
-
-    year = t->tm_year;
-
-    if (year < 70 || ((sizeof(time_t) <= 4) && (year >= 138)))
-       return BAD_DATE;
-
-    /* shift new year to 1st March in order to make leap year calc easy */
-
-    if (t->tm_mon < 2)
-       year--;
-
-    /* Find number of days since 1st March 1900 (in the Gregorian calendar). */
-
-    days = year * 365 + year / 4 - year / 100 + (year / 100 + 3) / 4;
-    days += dayoffset[t->tm_mon] + t->tm_mday - 1;
-    days -= 25508;             /* 1 jan 1970 is 25508 days since 1 mar 1900 */
-
-    days = ((days * 24 + t->tm_hour) * 60 + t->tm_min) * 60 + t->tm_sec;
-
-    if (days < 0)
-       return BAD_DATE;        /* must have overflowed */
-    else
-       return days;            /* must be a valid time */
-}
-
 /*
  * Parses an HTTP date in one of three standard forms:
  *