vcl-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jftho...@apache.org
Subject [vcl] branch develop updated: VCL-1109 - date duplicated on statistic graph labels for day after daylight saving time rolls back
Date Thu, 31 Jan 2019 15:59:11 GMT
This is an automated email from the ASF dual-hosted git repository.

jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git


The following commit(s) were added to refs/heads/develop by this push:
     new cc87c75  VCL-1109 - date duplicated on statistic graph labels for day after daylight
saving time rolls back
cc87c75 is described below

commit cc87c75751764937284d869d929ed9714739fa2b
Author: Josh Thompson <jfthomps@ncsu.edu>
AuthorDate: Thu Jan 31 10:53:07 2019 -0500

    VCL-1109 - date duplicated on statistic graph labels for day after daylight saving time
rolls back
    
    The fix mentioned in VCL-1109 of just adding a value to the label doesn't really fix the
underlying problem and give incorrect values on the graphs. A better fix was to change the
timezone to UTC before doing any date work so that DST isn't used.
    
    statistics.php: modified getStatGraphDayData, getStatGraphDayConUsersData, getStatGraphConBladeUserData,
and getStatGraphConVMUserData: added a call at the beginning of each function to get the current
timezone, then set the timezone to UTC; added a call before any returns in each function that
sets the timezone back to was was retreived at the beginning of the function
---
 web/.ht-inc/statistics.php | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/web/.ht-inc/statistics.php b/web/.ht-inc/statistics.php
index 4127fe1..cd85fda 100644
--- a/web/.ht-inc/statistics.php
+++ b/web/.ht-inc/statistics.php
@@ -665,6 +665,8 @@ function AJgetStatData() {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getStatGraphDayData($start, $end, $affilid, $mode, $provid) {
+	$tz = date_default_timezone_get();
+	date_default_timezone_set('UTC');
 	$startunix = datetimeToUnix($start . " 00:00:00");
 	$endunix = datetimeToUnix($end . " 23:59:59");
 
@@ -749,6 +751,7 @@ function getStatGraphDayData($start, $end, $affilid, $mode, $provid) {
 	}
 	if(count($addcache))
 		addToStatGraphCache('totalres', $addcache, $affilid, $provid);
+	date_default_timezone_set($tz);
 	return($data);
 }
 
@@ -920,6 +923,8 @@ function statHourFormatX($val) {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getStatGraphDayConUsersData($start, $end, $affilid, $mode, $provid) {
+	$tz = date_default_timezone_get();
+	date_default_timezone_set('UTC');
 	$startdt = $start . " 00:00:00";
 	$enddt = $end . " 23:59:59";
 	$startunix = datetimeToUnix($startdt);
@@ -955,6 +960,7 @@ function getStatGraphDayConUsersData($start, $end, $affilid, $mode, $provid)
{
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
 		$data = array('nodata' => i('(too much computational time required to generate this
graph)'));
+		date_default_timezone_set($tz);
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {
@@ -1038,6 +1044,7 @@ function getStatGraphDayConUsersData($start, $end, $affilid, $mode,
$provid) {
 	}
 	if(count($addcache))
 		addToStatGraphCache('concurres', $addcache, $affilid, $provid);
+	date_default_timezone_set($tz);
 	return($data);
 }
 
@@ -1064,6 +1071,8 @@ function getStatGraphDayConUsersData($start, $end, $affilid, $mode,
$provid) {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getStatGraphConBladeUserData($start, $end, $affilid, $mode, $provid) {
+	$tz = date_default_timezone_get();
+	date_default_timezone_set('UTC');
 	$startdt = $start . " 00:00:00";
 	$enddt = $end . " 23:59:59";
 	$startunix = datetimeToUnix($startdt);
@@ -1099,6 +1108,7 @@ function getStatGraphConBladeUserData($start, $end, $affilid, $mode,
$provid) {
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
 		$data = array('nodata' => i('(too much computational time required to generate this
graph)'));
+		date_default_timezone_set($tz);
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {
@@ -1216,6 +1226,7 @@ function getStatGraphConBladeUserData($start, $end, $affilid, $mode,
$provid) {
 	}
 	if(count($addcache))
 		addToStatGraphCache('concurblade', $addcache, $affilid, $provid);
+	date_default_timezone_set($tz);
 	return($data);
 }
 
@@ -1242,6 +1253,8 @@ function getStatGraphConBladeUserData($start, $end, $affilid, $mode,
$provid) {
 ///
 ////////////////////////////////////////////////////////////////////////////////
 function getStatGraphConVMUserData($start, $end, $affilid, $mode, $provid) {
+	$tz = date_default_timezone_get();
+	date_default_timezone_set('UTC');
 	$startdt = $start . " 00:00:00";
 	$enddt = $end . " 23:59:59";
 	$startunix = datetimeToUnix($startdt);
@@ -1277,6 +1290,7 @@ function getStatGraphConVMUserData($start, $end, $affilid, $mode, $provid)
{
 		$cachepts[$row['statdate']] = $row['value'];
 	if((count($cachepts) + 31) < $daycnt) {
 		$data = array('nodata' => i('(too much computational time required to generate this
graph)'));
+		date_default_timezone_set($tz);
 		return $data;
 	}
 	for($daystart = $startunix; $daystart < $endunix; $daystart += SECINDAY) {
@@ -1378,6 +1392,7 @@ function getStatGraphConVMUserData($start, $end, $affilid, $mode, $provid)
{
 	}
 	if(count($addcache))
 		addToStatGraphCache('concurvm', $addcache, $affilid, $provid);
+	date_default_timezone_set($tz);
 	return($data);
 }
 


Mime
View raw message