From: Kevin Cernekee Date: Thu, 17 Mar 2011 19:38:30 GMT Subject: [PATCH v2 2/3] gitweb: introduce localtime feature Message-ID: In-Reply-To: With this feature enabled, all timestamps are shown in the local timezone instead of GMT. The timezone is taken from the appropriate timezone string stored in the commit object. Affected views include: summary page, last change field (commit time from latest change) commit page, author/committer commitdiff page, author/committer log page, author time No change to: relative timestamps patch page Signed-off-by: Kevin Cernekee --- gitweb/gitweb.perl | 21 ++++++++++++++++++++- 1 files changed, 20 insertions(+), 1 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index 57a3caf..bf341cb 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -504,6 +504,19 @@ our %feature = ( 'sub' => sub { feature_bool('remote_heads', @_) }, 'override' => 0, 'default' => [0]}, + + # Use the author/commit localtime rather than GMT for all timestamps. + # Disabled by default. + + # To enable system wide have in $GITWEB_CONFIG + # $feature{'localtime'}{'default'} = [1]; + # To have project specific config enable override in $GITWEB_CONFIG + # $feature{'localtime'}{'override'} = 1; + # and in project config gitweb.localtime = 0|1; + 'localtime' => { + 'sub' => sub { feature_bool('localtime', @_) }, + 'override' => 0, + 'default' => [0]}, ); sub gitweb_get_feature { @@ -2928,6 +2941,12 @@ sub parse_date { $date{'iso-tz'} = sprintf("%04d-%02d-%02d %02d:%02d:%02d %s", 1900+$year, $mon+1, $mday, $hour, $min, $sec, $tz); + + if (gitweb_check_feature('localtime')) { + $date{'rfc2822'} = sprintf "%s, %d %s %4d %02d:%02d:%02d $tz", + $days[$wday], $mday, $months[$mon], + 1900+$year, $hour ,$min, $sec; + } return %date; } @@ -3990,7 +4009,7 @@ sub git_print_authorship_rows { "\n" . "" . " $wd{'rfc2822'}"; - print_local_time(%wd); + print_local_time(%wd) if !gitweb_check_feature('localtime'); print "" . "\n"; } -- 1.7.4.1