From: Gilles Darold Date: Wed, 17 Oct 2018 17:21:23 +0000 (+0200) Subject: Auto adjust javascript graph timezone. Thanks to Massimino Sala for the feature request. X-Git-Tag: v10.2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=80975e02d6d87738bde2bddbf2b84c4abf0a398d;p=pgbadger Auto adjust javascript graph timezone. Thanks to Massimino Sala for the feature request. --- diff --git a/pgbadger b/pgbadger index 67ac0c5..400866b 100755 --- a/pgbadger +++ b/pgbadger @@ -744,6 +744,14 @@ $top ||= 20; # Set timezone $timezone = ((0-$timezone)*3600); $log_timezone = ((0-$log_timezone)*3600); +if (!$timezone) { + my @lt = localtime(); + my @gt = gmtime(); + my $hour_diff = $gt[2] - $lt[2]; + my $min_diff = $gt[1] - $lt[1]; + $hour_diff += $lt[8]; + $timezone = ($hour_diff * 3600) + ($min_diff * 60); +} # Set the default extension and output format if (!$extension) {