Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Commit

Permalink
fix(acceptance): update acceptance tests with dst
Browse files Browse the repository at this point in the history
  • Loading branch information
kduret committed Oct 16, 2017
1 parent fd993f0 commit 22ef7c4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions features/bootstrap/DowntimeDSTContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,9 @@ public function aDowntimeDuringAllDayOnSummerChangingDateIsScheduled()
public function aDowntimeOfNextDayOfSummerChangingDate()
{
$this->downtimeProperties = array(
'start_day' => '2021/03/28',
'start_day' => '2021/03/29',
'start_time' => '00:00',
'end_day' => '2021/03/28',
'end_day' => '2021/03/29',
'end_time' => '24:00',
'expected_start' => '2021-03-29 00:00',
'expected_end' => '2021-03-30 00:00',
Expand Down
2 changes: 1 addition & 1 deletion www/class/centreonDowntime.Broker.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ private function manageSummerToWinterTimestamp($timestamp, $timezone)
{
$dstDate = new DateTime('now', $timezone);
$dstDate->setTimestamp($timestamp);
$dateTime2 = clone($dstDate);
$dateTime2 = clone $dstDate;
$dateTime2->setTimestamp($timestamp - 3600);

if ($dateTime2->getTimestamp() == $dstDate->getTimestamp()) {
Expand Down
6 changes: 3 additions & 3 deletions www/class/centreonExternalCommand.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ private function getDowntimeTimestampFromDate($date = 'now', $timezone = '', $st
$dateTime = new \DateTime($date, new \DateTimeZone($timezone));

// Winter to summer dst
$dateTime2 = clone($dateTime);
$dateTime2 = clone $dateTime;
$dateTime2->setTimestamp($dateTime2->getTimestamp());
if ($dateTime2->format("H") != $dateTime->format("H")) {
$hour = $dateTime->format('H');
Expand All @@ -414,7 +414,7 @@ private function getDowntimeTimestampFromDate($date = 'now', $timezone = '', $st
}

// Summer to winter dst
$dateTime3 = clone($dateTime);
$dateTime3 = clone $dateTime;
$dateTime3 = $dateTime3->setTimestamp($dateTime3->getTimestamp() - 3600);
if ($dateTime3->getTimestamp() == $dateTime->getTimestamp()) {
if ($start) {
Expand All @@ -424,7 +424,7 @@ private function getDowntimeTimestampFromDate($date = 'now', $timezone = '', $st
}
}

$dateTime4 = clone($dateTime);
$dateTime4 = clone $dateTime;
$dateTime4 = $dateTime3->setTimestamp($dateTime4->getTimestamp() + 3600);
if ($dateTime4->getTimestamp() == $dateTime->getTimestamp()) {
if ($start) {
Expand Down

0 comments on commit 22ef7c4

Please sign in to comment.