Skip to content

Commit ee941be

Browse files
Converts some utils.php functions to UTC.
Converts unixtime() to use gmmktime() instead of mktime(). Converts unix2mythtime() to use gmtime() instead of time(). Adds "UTC" parameter to myth2unixtime()'s strtotime(). Removes unix2gmtmythtime(time) since it now does exactly what unix2mythtime() does.
1 parent 8c43d8d commit ee941be

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

includes/utils.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,12 @@ function nice_length($length) {
161161
* Converts an sql timestamp into unixtime
162162
/**/
163163
function unixtime($sql_timestamp) {
164-
return mktime(substr($sql_timestamp, 8, 2), // hour
165-
substr($sql_timestamp, 10, 2), // minute
166-
substr($sql_timestamp, 12, 2), // second
167-
substr($sql_timestamp, 4, 2), // month
168-
substr($sql_timestamp, 6, 2), // day
169-
substr($sql_timestamp, 0, 4)); // year
164+
return gmmktime(substr($sql_timestamp, 8, 2), // hour
165+
substr($sql_timestamp, 10, 2), // minute
166+
substr($sql_timestamp, 12, 2), // second
167+
substr($sql_timestamp, 4, 2), // month
168+
substr($sql_timestamp, 6, 2), // day
169+
substr($sql_timestamp, 0, 4)); // year
170170
}
171171

172172
/**
@@ -315,20 +315,12 @@ function fequals($lhs, $rhs) {
315315
function myth2unixtime($mythtime) {
316316
if (strlen($mythtime) < 1)
317317
return '';
318-
return strtotime(str_replace('T', ' ', $mythtime));
318+
return strtotime(str_replace('T', ' ', $mythtime), "UTC");
319319
}
320320

321321
/**
322322
* Converts a unix timestamp into a myth timestamp
323323
/**/
324324
function unix2mythtime($time) {
325-
return date('Y-m-d\TH:i:s', $time);
326-
}
327-
328-
/**
329-
* Converts a unix timestamp into a myth timestamp
330-
/**/
331-
function unix2gmtmythtime($time) {
332325
return gmdate('Y-m-d\TH:i:s', $time);
333326
}
334-

modules/tv/classes/Program.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ public function thumb_url($width=160, $height=120, $secs_in=-1) {
488488
public static function get_preview_pixmap($hostname, $chanid, $starttime, $width=160, $height=120, $secs_in=null) {
489489

490490
return MythBackend::find($hostname)->httpRequest('Content/GetPreviewImage', array('ChanId' => $chanid,
491-
'StartTime' => unix2gmtmythtime($starttime),
491+
'StartTime' => unix2mythtime($starttime),
492492
'Height' => $height,
493493
'Width' => $width));
494494
}

0 commit comments

Comments
 (0)