Skip to content

Commit 78797e6

Browse files
committed
Removing another couple methods from the Time class that have not good
use anymore
1 parent b33b66b commit 78797e6

File tree

1 file changed

+0
-57
lines changed

1 file changed

+0
-57
lines changed

src/Utility/Time.php

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -85,63 +85,6 @@ public function __construct($time = null, $tz = null) {
8585
parent::__construct($time, $tz);
8686
}
8787

88-
89-
/**
90-
* Converts given time (in server's time zone) to user's local time, given his/her timezone.
91-
*
92-
* @param string $serverTime UNIX timestamp
93-
* @param string|\DateTimeZone $timezone User's timezone string or DateTimeZone object
94-
* @return int UNIX timestamp
95-
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::convert
96-
*/
97-
public static function convert($serverTime, $timezone) {
98-
static $serverTimezone = null;
99-
if ($serverTimezone === null || (date_default_timezone_get() !== $serverTimezone->getName())) {
100-
$serverTimezone = new \DateTimeZone(date_default_timezone_get());
101-
}
102-
$serverOffset = $serverTimezone->getOffset(new \DateTime('@' . $serverTime));
103-
$gmtTime = $serverTime - $serverOffset;
104-
if (is_numeric($timezone)) {
105-
$userOffset = $timezone * (60 * 60);
106-
} else {
107-
$timezone = static::timezone($timezone);
108-
$userOffset = $timezone->getOffset(new \DateTime('@' . $gmtTime));
109-
}
110-
$userTime = $gmtTime + $userOffset;
111-
return (int)$userTime;
112-
}
113-
114-
/**
115-
* Returns a timezone object from a string or the user's timezone object
116-
*
117-
* @param string|\DateTimeZone $timezone Timezone string or DateTimeZone object
118-
* If null it tries to get timezone from 'Config.timezone' config var
119-
* @return \DateTimeZone Timezone object
120-
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/time.html#TimeHelper::timezone
121-
*/
122-
public static function newTimezone($timezone = null) {
123-
static $tz = null;
124-
125-
if (is_object($timezone)) {
126-
if ($tz === null || $tz->getName() !== $timezone->getName()) {
127-
$tz = $timezone;
128-
}
129-
} else {
130-
if ($timezone === null) {
131-
$timezone = Configure::read('Config.timezone');
132-
if ($timezone === null) {
133-
$timezone = date_default_timezone_get();
134-
}
135-
}
136-
137-
if ($tz === null || $tz->getName() !== $timezone) {
138-
$tz = new \DateTimeZone($timezone);
139-
}
140-
}
141-
142-
return $tz;
143-
}
144-
14588
/**
14689
* Returns a nicely formatted date string for given Datetime string.
14790
*

0 commit comments

Comments
 (0)