Skip to content

Commit

Permalink
Changed time() to current_time( ) all to fix timezone issues
Browse files Browse the repository at this point in the history
The UTC offset was omitted by the WP date query, so the UTC timestamp
returned by time() was compared to a local timestamp.
  • Loading branch information
stklcode committed Nov 2, 2018
1 parent 65eafd2 commit 3eecaaf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion includes/class-scliveticker-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function widget( $args, $instance ) {
echo ' sclt-widget-ajax" '
. 'data-sclt-ticker="' . esc_attr( $category ) . '" '
. 'data-sclt-limit="' . esc_attr( $count ) . '" '
. 'data-sclt-last="' . esc_attr( time() );
. 'data-sclt-last="' . esc_attr( current_time( 'timestamp' ) );
}
echo '">';

Expand Down
6 changes: 3 additions & 3 deletions includes/class-scliveticker.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static function shortcode_ticker_show( $atts ) {
$output .= ' sclt-ticker-ajax" '
. 'data-sclt-ticker="' . $ticker . '" '
. 'data-sclt-limit="' . $limit . '" '
. 'data-sclt-last="' . time();
. 'data-sclt-last="' . current_time( 'timestamp' );
}
$output .= '">';

Expand Down Expand Up @@ -350,13 +350,13 @@ public static function ajax_update() {
$res[] = array(
'w' => $slug,
'h' => $out,
't' => time(),
't' => current_time( 'timestamp' ),
);
} else {
$res[] = array(
's' => $slug,
'h' => $out,
't' => time(),
't' => current_time( 'timestamp' ),
);
}
}
Expand Down

0 comments on commit 3eecaaf

Please sign in to comment.