Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev ][Date Next ][Thread Prev ][Thread Next ][Date Index ][Thread Index ]
Re: autoindex datetime
On Tue, 24 May 2005, Andrew Sitnikov wrote:
как я понял время показывается в UTC, хорошо бы иметь возможность в localtime
его видеть.
#>date -u
Tue May 24 10:08:17 UTC 2005
#>/home/upload>date
Tue May 24 13:09:30 EEST 2005
#>/home/upload>l incoming | grep general
drwxr-xr-x 2 upload users 48 2005-05-24 12:16 general/
nginx:
general/ 24-May-2005 09:16
-
Прилагаемый патч делает "autoindex_localtime on"
Игорь Сысоев
http://sysoev.ru --- src/http/modules/ngx_http_autoindex_module.c Tue May 3 22:35:18 2005
+++ src/http/modules/ngx_http_autoindex_module.c Tue May 24 15:00:36 2005
@@ -33,6 +33,7 @@
typedef struct {
ngx_flag_t enable;
+ ngx_flag_t localtime;
} ngx_http_autoindex_loc_conf_t;
@@ -58,6 +59,13 @@
offsetof(ngx_http_autoindex_loc_conf_t, enable),
NULL },
+ { ngx_string("autoindex_localtime"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_LOC_CONF_OFFSET,
+ offsetof(ngx_http_autoindex_loc_conf_t, localtime),
+ NULL },
+
ngx_null_command
};
@@ -391,7 +399,12 @@
*b->last++ = ' ';
- ngx_gmtime(entry[i].mtime, &tm);
+ if (alcf->localtime) {
+ ngx_gmtime(entry[i].mtime + ngx_gmtoff * 60, &tm);
+
+ } else {
+ ngx_gmtime(entry[i].mtime, &tm);
+ }
b->last = ngx_sprintf(b->last, "%02d-%s-%d %02d:%02d ",
tm.ngx_tm_mday,
@@ -542,6 +555,7 @@
}
conf->enable = NGX_CONF_UNSET;
+ conf->localtime = NGX_CONF_UNSET;
return conf;
}
@@ -554,6 +568,7 @@
ngx_http_autoindex_loc_conf_t *conf = child;
ngx_conf_merge_value(conf->enable, prev->enable, 0);
+ ngx_conf_merge_value(conf->localtime, prev->localtime, 0);
return NGX_CONF_OK;
}