Skip to content

Commit

Permalink
add timezone in timingTrait
Browse files Browse the repository at this point in the history
  • Loading branch information
marcogiovinazzi committed Sep 26, 2017
1 parent 6978765 commit f6802b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/Comodojo/Foundation/Timing/TimingTrait.php
@@ -1,6 +1,7 @@
<?php namespace Comodojo\Foundation\Timing;

use \DateTime;
use \DateTimeZone;
use \InvalidArgumentException;

/**
Expand Down Expand Up @@ -29,7 +30,7 @@ public function setTiming($time = null) {
$this->timing = microtime(true);
return $this;
} else if ( is_float($time) === false ) {
throw new InvalidArgumentException("Time reference should be a float number");
throw new InvalidArgumentException("Timing reference should be a float");
} else {
$this->timing = $time;
return $this;
Expand All @@ -45,7 +46,9 @@ public function getTiming() {

public function getTime() {

return DateTime::createFromFormat('U.u', $this->timing);
$timezone = new DateTimeZone(date_default_timezone_get());

return DateTime::createFromFormat('U.u', $this->timing)->setTimezone($timezone);

}

Expand Down

0 comments on commit f6802b4

Please sign in to comment.