use gmdate
This commit is contained in:
		@@ -237,7 +237,7 @@ class PlayerDetailed {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			$statProperties = $stat[0];
 | 
								$statProperties = $stat[0];
 | 
				
			||||||
			if ($statProperties->type === StatisticManager::STAT_TYPE_TIME) {
 | 
								if ($statProperties->type === StatisticManager::STAT_TYPE_TIME) {
 | 
				
			||||||
				$value = Formatter::formatTimeHMS($value);
 | 
									$value = Formatter::formatTimeH($value);
 | 
				
			||||||
			} else if ($statProperties->type === StatisticManager::STAT_TYPE_FLOAT) {
 | 
								} else if ($statProperties->type === StatisticManager::STAT_TYPE_FLOAT) {
 | 
				
			||||||
				$value = round($value, 2);
 | 
									$value = round($value, 2);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -243,7 +243,7 @@ class SimpleStatsList implements ManialinkPageAnswerListener, CallbackListener,
 | 
				
			|||||||
				if (isset($statRankings[$stat['Name']][$playerId])) {
 | 
									if (isset($statRankings[$stat['Name']][$playerId])) {
 | 
				
			||||||
					$statValue = $statRankings[$stat['Name']][$playerId];
 | 
										$statValue = $statRankings[$stat['Name']][$playerId];
 | 
				
			||||||
					if ($stat['Format'] == StatisticManager::STAT_TYPE_TIME) {
 | 
										if ($stat['Format'] == StatisticManager::STAT_TYPE_TIME) {
 | 
				
			||||||
						$statValue = Formatter::formatTimeHMS($statValue);
 | 
											$statValue = Formatter::formatTimeH($statValue);
 | 
				
			||||||
					} else if ($stat['Format'] == StatisticManager::STAT_TYPE_FLOAT) {
 | 
										} else if ($stat['Format'] == StatisticManager::STAT_TYPE_FLOAT) {
 | 
				
			||||||
						$statValue = round(floatval($statValue), 2);
 | 
											$statValue = round(floatval($statValue), 2);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,6 +28,7 @@ abstract class Formatter {
 | 
				
			|||||||
	 * @return string
 | 
						 * @return string
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public static function formatTime($time) {
 | 
						public static function formatTime($time) {
 | 
				
			||||||
 | 
							// TODO: use gmdate()
 | 
				
			||||||
		$time         = (int)$time;
 | 
							$time         = (int)$time;
 | 
				
			||||||
		$milliseconds = $time % 1000;
 | 
							$milliseconds = $time % 1000;
 | 
				
			||||||
		$seconds      = floor($time / 1000);
 | 
							$seconds      = floor($time / 1000);
 | 
				
			||||||
@@ -42,25 +43,6 @@ abstract class Formatter {
 | 
				
			|||||||
		return $format;
 | 
							return $format;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Format a Time to H:M:S
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * @param int $seconds
 | 
					 | 
				
			||||||
	 * @return string
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	public static function formatTimeHMS($seconds) {
 | 
					 | 
				
			||||||
		$minutes = floor($seconds / 60);
 | 
					 | 
				
			||||||
		$hours   = floor($minutes / 60);
 | 
					 | 
				
			||||||
		$minutes -= $hours * 60;
 | 
					 | 
				
			||||||
		$seconds -= ($hours * 3600 + $minutes * 60);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		$hours   = ($hours < 10 ? '0' : '') . $hours;
 | 
					 | 
				
			||||||
		$minutes = ($minutes < 10 ? '0' : '') . $minutes;;
 | 
					 | 
				
			||||||
		$seconds = ($seconds < 10 ? '0' : '') . $seconds;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return $hours . ":" . $minutes . ":" . $seconds;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Format an elapsed time String (2 days ago...) by a given timestamp
 | 
						 * Format an elapsed time String (2 days ago...) by a given timestamp
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
@@ -94,7 +76,7 @@ abstract class Formatter {
 | 
				
			|||||||
	 * @return string
 | 
						 * @return string
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public static function formatTimeH($seconds) {
 | 
						public static function formatTimeH($seconds) {
 | 
				
			||||||
		return date("H:i:s", $seconds);
 | 
							return gmdate('H:i:s', $seconds);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -104,7 +86,7 @@ abstract class Formatter {
 | 
				
			|||||||
	 * @return string
 | 
						 * @return string
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public static function formatTimestamp($seconds) {
 | 
						public static function formatTimestamp($seconds) {
 | 
				
			||||||
		return date("Y-m-d H:i:s", $seconds);
 | 
							return date('Y-m-d H:i:s', $seconds);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user