diff --git a/core/modules/history/history.module b/core/modules/history/history.module
index 0dfad16..0212bb5 100644
--- a/core/modules/history/history.module
+++ b/core/modules/history/history.module
@@ -100,10 +100,9 @@ function history_read_multiple($nids) {
  *   current user.
  */
 function history_write($nid, $account = NULL) {
-  global $user;
 
   if (!isset($account)) {
-    $account = $user;
+    $account = Drupal::currentUser();
   }
 
   if ($account->isAuthenticated()) {
diff --git a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
index 91db271..ff4c86c 100644
--- a/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
+++ b/core/modules/history/lib/Drupal/history/Plugin/views/field/HistoryUserTimestamp.php
@@ -31,8 +31,7 @@ class HistoryUserTimestamp extends Node {
   public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
     parent::init($view, $display, $options);
 
-    global $user;
-    if ($user->isAuthenticated()) {
+    if (\Drupal::currentUser()->isAuthenticated()) {
       $this->additional_fields['created'] = array('table' => 'node_field_data', 'field' => 'created');
       $this->additional_fields['changed'] = array('table' => 'node_field_data', 'field' => 'changed');
       if (module_exists('comment') && !empty($this->options['comments'])) {
@@ -62,8 +61,7 @@ public function buildOptionsForm(&$form, &$form_state) {
 
   public function query() {
     // Only add ourselves to the query if logged in.
-    global $user;
-    if ($user->isAnonymous()) {
+    if (\Drupal::currentUser()->isAnonymous()) {
       return;
     }
     parent::query();
@@ -77,8 +75,7 @@ public function render(ResultRow $values) {
     // This code shadows node_mark, but it reads from the db directly and
     // we already have that info.
     $mark = MARK_READ;
-    global $user;
-    if ($user->isAuthenticated()) {
+    if (\Drupal::currentUser()->isAuthenticated()) {
       $last_read = $this->getValue($values);
       $changed = $this->getValue($values, 'changed');
 
diff --git a/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php b/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
index 182174c..9748b99 100644
--- a/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
+++ b/core/modules/history/lib/Drupal/history/Tests/Views/HistoryTimestampTest.php
@@ -49,7 +49,6 @@ public function testHandlers() {
 
     $account = $this->drupalCreateUser();
     $this->drupalLogin($account);
-    $GLOBALS['user'] = $account;
 
     db_insert('history')
       ->fields(array(
