Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion includes/templates/class-amp-post-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private function build_post_publish_timestamp() {
$format = 'U';

if ( empty( $this->post->post_date_gmt ) || '0000-00-00 00:00:00' === $this->post->post_date_gmt ) {
$timestamp = time();
$timestamp = (int) get_the_time('U');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of time() came from #5450. Why use get_the_time()?

For one thing, it's not passing the $this->post as context.

} else {
$timestamp = (int) get_post_time( $format, true, $this->post, true );
}
Expand Down
2 changes: 1 addition & 1 deletion templates/meta-time.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
sprintf(
/* translators: %s: the human-readable time difference. */
__( '%s ago', 'amp' ),
human_time_diff( $this->get( 'post_publish_timestamp' ), time() )
human_time_diff( $this->get( 'post_publish_timestamp' ), current_time('timestamp') )
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually used to be current_time( 'timestamp' ) before, but it was changed in 39473e3. Its use was discouraged as of WordPress/WordPress-Coding-Standards#1791.

)
);
?>
Expand Down