You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Joe Orton <jo...@orton.demon.co.uk> on 2000/07/03 12:06:24 UTC
[PATCH] mod_dav: convert dav_format_time to APR
This converts dav_format_time to use APR.
joe
--- repos.c 2000/07/01 14:02:52 1.4
+++ repos.c 2000/07/03 09:51:09
@@ -232,19 +232,20 @@ void dav_fs_dir_file_name(
/* Note: picked up from ap_gm_timestr_822() */
/* NOTE: buf must be at least DAV_TIMEBUF_SIZE chars in size */
-static void dav_format_time(int style, time_t sec, char *buf)
+static void dav_format_time(int style, ap_time_t sec, char *buf)
{
- struct tm *tms;
+ ap_exploded_time_t tms;
+
+ /* ### what to do if fails? */
+ (void) ap_explode_gmt(&tms, sec);
- tms = gmtime(&sec);
-
if (style == DAV_STYLE_ISO8601) {
/* ### should we use "-00:00" instead of "Z" ?? */
/* 20 chars plus null term */
sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ",
- tms->tm_year + 1900, tms->tm_mon + 1, tms->tm_mday,
- tms->tm_hour, tms->tm_min, tms->tm_sec);
+ tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
return;
}
@@ -253,10 +254,10 @@ static void dav_format_time(int style, t
/* 29 chars plus null term */
sprintf(buf,
"%s, %.2d %s %d %.2d:%.2d:%.2d GMT",
- ap_day_snames[tms->tm_wday],
- tms->tm_mday, ap_month_snames[tms->tm_mon],
- tms->tm_year + 1900,
- tms->tm_hour, tms->tm_min, tms->tm_sec);
+ ap_day_snames[tms.tm_wday],
+ tms.tm_mday, ap_month_snames[tms.tm_mon],
+ tms.tm_year + 1900,
+ tms.tm_hour, tms.tm_min, tms.tm_sec);
}
static int dav_sync_write(int fd, const char *buf, ssize_t bufsize)
Re: [PATCH] mod_dav: convert dav_format_time to APR
Posted by Greg Stein <gs...@lyra.org>.
Applied and committed.
Please make sure to diff against CVS; the patch below had spaces instead of
tabs. I was able to use the -l switch to patch, but it sure confoozled me
there for a bit :-)
Thanx for the fix!
Cheers,
-g
On Mon, Jul 03, 2000 at 11:06:24AM +0100, Joe Orton wrote:
> This converts dav_format_time to use APR.
>
> joe
>
> --- repos.c 2000/07/01 14:02:52 1.4
> +++ repos.c 2000/07/03 09:51:09
> @@ -232,19 +232,20 @@ void dav_fs_dir_file_name(
>
> /* Note: picked up from ap_gm_timestr_822() */
> /* NOTE: buf must be at least DAV_TIMEBUF_SIZE chars in size */
> -static void dav_format_time(int style, time_t sec, char *buf)
> +static void dav_format_time(int style, ap_time_t sec, char *buf)
> {
> - struct tm *tms;
> + ap_exploded_time_t tms;
> +
> + /* ### what to do if fails? */
> + (void) ap_explode_gmt(&tms, sec);
>
> - tms = gmtime(&sec);
> -
> if (style == DAV_STYLE_ISO8601) {
> /* ### should we use "-00:00" instead of "Z" ?? */
>
> /* 20 chars plus null term */
> sprintf(buf, "%.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ",
> - tms->tm_year + 1900, tms->tm_mon + 1, tms->tm_mday,
> - tms->tm_hour, tms->tm_min, tms->tm_sec);
> + tms.tm_year + 1900, tms.tm_mon + 1, tms.tm_mday,
> + tms.tm_hour, tms.tm_min, tms.tm_sec);
> return;
> }
>
> @@ -253,10 +254,10 @@ static void dav_format_time(int style, t
> /* 29 chars plus null term */
> sprintf(buf,
> "%s, %.2d %s %d %.2d:%.2d:%.2d GMT",
> - ap_day_snames[tms->tm_wday],
> - tms->tm_mday, ap_month_snames[tms->tm_mon],
> - tms->tm_year + 1900,
> - tms->tm_hour, tms->tm_min, tms->tm_sec);
> + ap_day_snames[tms.tm_wday],
> + tms.tm_mday, ap_month_snames[tms.tm_mon],
> + tms.tm_year + 1900,
> + tms.tm_hour, tms.tm_min, tms.tm_sec);
> }
>
> static int dav_sync_write(int fd, const char *buf, ssize_t bufsize)
--
Greg Stein, http://www.lyra.org/