diff options
Diffstat (limited to 'time')
-rw-r--r-- | time/unix/time.c | 50 | ||||
-rw-r--r-- | time/unix/timestr.c | 18 | ||||
-rw-r--r-- | time/win32/access.c | 30 | ||||
-rw-r--r-- | time/win32/time.c | 27 | ||||
-rw-r--r-- | time/win32/timestr.c | 18 |
5 files changed, 73 insertions, 70 deletions
diff --git a/time/unix/time.c b/time/unix/time.c index 60a29c189..96b5d6644 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -76,9 +76,9 @@ /* End System Headers */ -apr_status_t apr_ansi_time_to_ap_time(apr_time_t *result, time_t input) +apr_status_t apr_ansi_time_to_apr_time(apr_time_t *result, time_t input) { - *result = (apr_time_t)input * AP_USEC_PER_SEC; + *result = (apr_time_t)input * APR_USEC_PER_SEC; return APR_SUCCESS; } @@ -87,11 +87,11 @@ apr_time_t apr_now(void) { struct timeval tv; gettimeofday(&tv, NULL); - return tv.tv_sec * AP_USEC_PER_SEC + tv.tv_usec; + return tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec; } -static void tm_to_exp(ap_exploded_time_t *xt, struct tm *tm) +static void tm_to_exp(apr_exploded_time_t *xt, struct tm *tm) { xt->tm_sec = tm->tm_sec; xt->tm_min = tm->tm_min; @@ -105,14 +105,14 @@ static void tm_to_exp(ap_exploded_time_t *xt, struct tm *tm) } -apr_status_t apr_explode_gmt(ap_exploded_time_t *result, apr_time_t input) +apr_status_t apr_explode_gmt(apr_exploded_time_t *result, apr_time_t input) { - time_t t = input / AP_USEC_PER_SEC; + time_t t = input / APR_USEC_PER_SEC; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) struct tm banana; #endif - result->tm_usec = input % AP_USEC_PER_SEC; + result->tm_usec = input % APR_USEC_PER_SEC; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) gmtime_r(&t, &banana); @@ -124,13 +124,13 @@ apr_status_t apr_explode_gmt(ap_exploded_time_t *result, apr_time_t input) return APR_SUCCESS; } -apr_status_t apr_explode_localtime(ap_exploded_time_t *result, apr_time_t input) +apr_status_t apr_explode_localtime(apr_exploded_time_t *result, apr_time_t input) { #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) - time_t t = input / AP_USEC_PER_SEC; + time_t t = input / APR_USEC_PER_SEC; struct tm apricot; - result->tm_usec = input % AP_USEC_PER_SEC; + result->tm_usec = input % APR_USEC_PER_SEC; localtime_r(&t, &apricot); tm_to_exp(result, &apricot); @@ -152,10 +152,10 @@ apr_status_t apr_explode_localtime(ap_exploded_time_t *result, apr_time_t input) } #endif #else - time_t t = input / AP_USEC_PER_SEC; + time_t t = input / APR_USEC_PER_SEC; struct tm *tmx; - result->tm_usec = input % AP_USEC_PER_SEC; + result->tm_usec = input % APR_USEC_PER_SEC; tmx = localtime(&t); tm_to_exp(result, tmx); @@ -181,7 +181,7 @@ apr_status_t apr_explode_localtime(ap_exploded_time_t *result, apr_time_t input) } -apr_status_t apr_implode_time(apr_time_t *t, ap_exploded_time_t *xt) +apr_status_t apr_implode_time(apr_time_t *t, apr_exploded_time_t *xt) { int year; time_t days; @@ -211,18 +211,19 @@ apr_status_t apr_implode_time(apr_time_t *t, ap_exploded_time_t *xt) return APR_EBADDATE; } days -= xt->tm_gmtoff; - *t = days * AP_USEC_PER_SEC + xt->tm_usec; + *t = days * APR_USEC_PER_SEC + xt->tm_usec; return APR_SUCCESS; } apr_status_t apr_get_os_imp_time(apr_os_imp_time_t **ostime, apr_time_t *aprtime) { - (*ostime)->tv_usec = *aprtime % AP_USEC_PER_SEC; - (*ostime)->tv_sec = *aprtime / AP_USEC_PER_SEC; + (*ostime)->tv_usec = *aprtime % APR_USEC_PER_SEC; + (*ostime)->tv_sec = *aprtime / APR_USEC_PER_SEC; return APR_SUCCESS; } -apr_status_t apr_get_os_exp_time(apr_os_exp_time_t **ostime, ap_exploded_time_t *aprtime) +apr_status_t apr_get_os_exp_time(apr_os_exp_time_t **ostime, + apr_exploded_time_t *aprtime) { (*ostime)->tm_sec = aprtime->tm_sec; (*ostime)->tm_min = aprtime->tm_min; @@ -239,12 +240,12 @@ apr_status_t apr_get_os_exp_time(apr_os_exp_time_t **ostime, ap_exploded_time_t apr_status_t apr_put_os_imp_time(apr_time_t *aprtime, apr_os_imp_time_t **ostime, apr_pool_t *cont) { - *aprtime = (*ostime)->tv_sec * AP_USEC_PER_SEC + (*ostime)->tv_usec; + *aprtime = (*ostime)->tv_sec * APR_USEC_PER_SEC + (*ostime)->tv_usec; return APR_SUCCESS; } -apr_status_t apr_put_os_exp_time(ap_exploded_time_t *aprtime, - apr_os_exp_time_t **ostime, apr_pool_t *cont) +apr_status_t apr_put_os_exp_time(apr_exploded_time_t *aprtime, + apr_os_exp_time_t **ostime, apr_pool_t *cont) { aprtime->tm_sec = (*ostime)->tm_sec; aprtime->tm_min = (*ostime)->tm_min; @@ -264,14 +265,15 @@ void apr_sleep(apr_interval_time_t t) DosSleep(t/1000); #else struct timeval tv; - tv.tv_usec = t % AP_USEC_PER_SEC; - tv.tv_sec = t / AP_USEC_PER_SEC; + tv.tv_usec = t % APR_USEC_PER_SEC; + tv.tv_sec = t / APR_USEC_PER_SEC; select(0, NULL, NULL, NULL, &tv); #endif } #ifdef OS2 -apr_status_t ap_os2_time_to_ap_time(apr_time_t *result, FDATE os2date, FTIME os2time) +apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, + FTIME os2time) { struct tm tmpdate; @@ -285,7 +287,7 @@ apr_status_t ap_os2_time_to_ap_time(apr_time_t *result, FDATE os2date, FTIME os2 tmpdate.tm_year = os2date.year + 80; tmpdate.tm_isdst = -1; - *result = mktime(&tmpdate) * AP_USEC_PER_SEC; + *result = mktime(&tmpdate) * APR_USEC_PER_SEC; return APR_SUCCESS; } #endif diff --git a/time/unix/timestr.c b/time/unix/timestr.c index 22b342dcf..52aa1f148 100644 --- a/time/unix/timestr.c +++ b/time/unix/timestr.c @@ -68,18 +68,18 @@ #endif /* End System Headers */ -APR_VAR_EXPORT const char ap_month_snames[12][4] = +APR_VAR_EXPORT const char apr_month_snames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -APR_VAR_EXPORT const char ap_day_snames[7][4] = +APR_VAR_EXPORT const char apr_day_snames[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) { - ap_exploded_time_t xt; + apr_exploded_time_t xt; const char *s; int real_year; @@ -88,7 +88,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */ /* 12345678901234567890123456789 */ - s = &ap_day_snames[xt.tm_wday][0]; + s = &apr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -97,7 +97,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) *date_str++ = xt.tm_mday / 10 + '0'; *date_str++ = xt.tm_mday % 10 + '0'; *date_str++ = ' '; - s = &ap_month_snames[xt.tm_mon][0]; + s = &apr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -127,7 +127,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) apr_status_t apr_ctime(char *date_str, apr_time_t t) { - ap_exploded_time_t xt; + apr_exploded_time_t xt; const char *s; int real_year; @@ -135,12 +135,12 @@ apr_status_t apr_ctime(char *date_str, apr_time_t t) /* 123456789012345678901234 */ apr_explode_localtime(&xt, t); - s = &ap_day_snames[xt.tm_wday][0]; + s = &apr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = ' '; - s = &ap_month_snames[xt.tm_mon][0]; + s = &apr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -168,7 +168,7 @@ apr_status_t apr_ctime(char *date_str, apr_time_t t) } apr_status_t apr_strftime(char *s, apr_size_t *retsize, apr_size_t max, - const char *format, ap_exploded_time_t *xt) + const char *format, apr_exploded_time_t *xt) { struct tm tm; diff --git a/time/win32/access.c b/time/win32/access.c index e38d7d575..0bc5f8719 100644 --- a/time/win32/access.c +++ b/time/win32/access.c @@ -57,7 +57,7 @@ #include "apr_general.h" #include "apr_lib.h" -apr_status_t ap_get_curtime(struct atime_t *time, apr_time_t *rv) +apr_status_t apr_get_curtime(struct atime_t *time, apr_time_t *rv) { if (time) { (*rv) = time->currtime; @@ -66,7 +66,7 @@ apr_status_t ap_get_curtime(struct atime_t *time, apr_time_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_sec(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_sec(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wSecond; @@ -75,7 +75,7 @@ apr_status_t ap_get_sec(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_min(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_min(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wMinute; @@ -84,7 +84,7 @@ apr_status_t ap_get_min(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_hour(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_hour(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wHour; @@ -93,7 +93,7 @@ apr_status_t ap_get_hour(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_mday(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_mday(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wDay; @@ -102,7 +102,7 @@ apr_status_t ap_get_mday(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_mon(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_mon(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wMonth; @@ -111,7 +111,7 @@ apr_status_t ap_get_mon(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_year(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_year(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wYear; @@ -120,7 +120,7 @@ apr_status_t ap_get_year(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_get_wday(struct atime_t *time, apr_int32_t *rv) +apr_status_t apr_get_wday(struct atime_t *time, apr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wDayOfWeek; @@ -129,7 +129,7 @@ apr_status_t ap_get_wday(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t ap_set_sec(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_sec(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -145,7 +145,7 @@ apr_status_t ap_set_sec(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_min(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_min(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -161,7 +161,7 @@ apr_status_t ap_set_min(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_hour(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_hour(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -177,7 +177,7 @@ apr_status_t ap_set_hour(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_mday(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_mday(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -193,7 +193,7 @@ apr_status_t ap_set_mday(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_mon(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_mon(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -209,7 +209,7 @@ apr_status_t ap_set_mon(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_year(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_year(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; @@ -225,7 +225,7 @@ apr_status_t ap_set_year(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t ap_set_wday(struct atime_t *time, apr_int32_t value) +apr_status_t apr_set_wday(struct atime_t *time, apr_int32_t value) { if (!time) { return APR_ENOTIME; diff --git a/time/win32/time.c b/time/win32/time.c index 899a57a55..f45f74850 100644 --- a/time/win32/time.c +++ b/time/win32/time.c @@ -65,7 +65,7 @@ /* Number of micro-seconds between the beginning of the Windows epoch * (Jan. 1, 1601) and the Unix epoch (Jan. 1, 1970) */ -#define AP_DELTA_EPOCH_IN_USEC 11644473600000000; +#define APR_DELTA_EPOCH_IN_USEC 11644473600000000; void FileTimeToAprTime(apr_time_t *result, FILETIME *input) { @@ -74,20 +74,20 @@ void FileTimeToAprTime(apr_time_t *result, FILETIME *input) *result = (*result) << 32; *result |= input->dwLowDateTime; *result /= 10; /* Convert from 100 nano-sec periods to micro-seconds. */ - *result -= AP_DELTA_EPOCH_IN_USEC; /* Convert from Windows epoch to Unix epoch */ + *result -= APR_DELTA_EPOCH_IN_USEC; /* Convert from Windows epoch to Unix epoch */ return; } void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) { LONGLONG ll; - t += AP_DELTA_EPOCH_IN_USEC; + t += APR_DELTA_EPOCH_IN_USEC; ll = t * 10; pft->dwLowDateTime = (DWORD)ll; pft->dwHighDateTime = (DWORD) (ll >> 32); return; } -void SystemTimeToAprExpTime(ap_exploded_time_t *xt, SYSTEMTIME *tm) +void SystemTimeToAprExpTime(apr_exploded_time_t *xt, SYSTEMTIME *tm) { TIME_ZONE_INFORMATION tz; DWORD rc; @@ -123,9 +123,9 @@ void SystemTimeToAprExpTime(ap_exploded_time_t *xt, SYSTEMTIME *tm) return; } -apr_status_t apr_ansi_time_to_ap_time(apr_time_t *result, time_t input) +apr_status_t apr_ansi_time_to_apr_time(apr_time_t *result, time_t input) { - *result = (apr_time_t) input * AP_USEC_PER_SEC; + *result = (apr_time_t) input * APR_USEC_PER_SEC; return APR_SUCCESS; } @@ -139,7 +139,7 @@ apr_time_t apr_now(void) return aprtime; } -apr_status_t apr_explode_gmt(ap_exploded_time_t *result, apr_time_t input) +apr_status_t apr_explode_gmt(apr_exploded_time_t *result, apr_time_t input) { FILETIME ft; SYSTEMTIME st; @@ -149,7 +149,7 @@ apr_status_t apr_explode_gmt(ap_exploded_time_t *result, apr_time_t input) return APR_SUCCESS; } -apr_status_t apr_explode_localtime(ap_exploded_time_t *result, apr_time_t input) +apr_status_t apr_explode_localtime(apr_exploded_time_t *result, apr_time_t input) { SYSTEMTIME st; FILETIME ft, localft; @@ -161,7 +161,7 @@ apr_status_t apr_explode_localtime(ap_exploded_time_t *result, apr_time_t input) return APR_SUCCESS; } -apr_status_t apr_implode_time(apr_time_t *t, ap_exploded_time_t *xt) +apr_status_t apr_implode_time(apr_time_t *t, apr_exploded_time_t *xt) { int year; time_t days; @@ -191,7 +191,7 @@ apr_status_t apr_implode_time(apr_time_t *t, ap_exploded_time_t *xt) return APR_EBADDATE; } days -= xt->tm_gmtoff; - *t = days * AP_USEC_PER_SEC + xt->tm_usec; + *t = days * APR_USEC_PER_SEC + xt->tm_usec; return APR_SUCCESS; } @@ -202,7 +202,8 @@ apr_status_t apr_get_os_imp_time(apr_os_imp_time_t **ostime, apr_time_t *aprtime return APR_SUCCESS; } -apr_status_t apr_get_os_exp_time(apr_os_exp_time_t **ostime, ap_exploded_time_t *aprexptime) +apr_status_t apr_get_os_exp_time(apr_os_exp_time_t **ostime, + apr_exploded_time_t *aprexptime) { (*ostime)->wYear = aprexptime->tm_year + 1900; (*ostime)->wMonth = aprexptime->tm_mon + 1; @@ -222,8 +223,8 @@ apr_status_t apr_put_os_imp_time(apr_time_t *aprtime, apr_os_imp_time_t **ostime return APR_SUCCESS; } -apr_status_t apr_put_os_exp_time(ap_exploded_time_t *aprtime, - apr_os_exp_time_t **ostime, apr_pool_t *cont) +apr_status_t apr_put_os_exp_time(apr_exploded_time_t *aprtime, + apr_os_exp_time_t **ostime, apr_pool_t *cont) { SystemTimeToAprExpTime(aprtime, *ostime); return APR_SUCCESS; diff --git a/time/win32/timestr.c b/time/win32/timestr.c index df8254c55..4f397cdd3 100644 --- a/time/win32/timestr.c +++ b/time/win32/timestr.c @@ -55,18 +55,18 @@ #include "atime.h" #include "apr_portable.h" -APR_VAR_EXPORT const char ap_month_snames[12][4] = +APR_VAR_EXPORT const char apr_month_snames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -APR_VAR_EXPORT const char ap_day_snames[7][4] = +APR_VAR_EXPORT const char apr_day_snames[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) { - ap_exploded_time_t xt; + apr_exploded_time_t xt; const char *s; int real_year; @@ -75,7 +75,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */ /* 12345678901234567890123456789 */ - s = &ap_day_snames[xt.tm_wday][0]; + s = &apr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -84,7 +84,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) *date_str++ = xt.tm_mday / 10 + '0'; *date_str++ = xt.tm_mday % 10 + '0'; *date_str++ = ' '; - s = &ap_month_snames[xt.tm_mon][0]; + s = &apr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -114,7 +114,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) apr_status_t apr_ctime(char *date_str, apr_time_t t) { - ap_exploded_time_t xt; + apr_exploded_time_t xt; const char *s; int real_year; @@ -122,12 +122,12 @@ apr_status_t apr_ctime(char *date_str, apr_time_t t) /* 123456789012345678901234 */ apr_explode_localtime(&xt, t); - s = &ap_day_snames[xt.tm_wday][0]; + s = &apr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = ' '; - s = &ap_month_snames[xt.tm_mon][0]; + s = &apr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -155,7 +155,7 @@ apr_status_t apr_ctime(char *date_str, apr_time_t t) } apr_status_t apr_strftime(char *s, apr_size_t *retsize, apr_size_t max, - const char *format, ap_exploded_time_t *xt) + const char *format, apr_exploded_time_t *xt) { struct tm tm; memset(&tm, 0, sizeof tm); |