<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">https://bugs.launchpad.net/percona-toolkit/+bug/962330
https://bugs.launchpad.net/percona-toolkit/+bug/1095476

diff --git a/bin/pt-slave-delay b/bin/pt-slave-delay
index 750b733..fca04e4 100755
--- a/bin/pt-slave-delay
+++ b/bin/pt-slave-delay
@@ -4244,6 +4244,7 @@ sub main {
    my ( $TS, $FILE, $POS ) = ( 0, 1, 2 );
    my @positions;
    my $next_start = 0;
+   my $initial_delay = 0;
    $now    = time();
    my $end = $now + ( $o-&gt;get('run-time') || 0 );    # When we should exit
 
@@ -4258,6 +4259,10 @@ sub main {
       die "Slave SQL thread is not running";
    }
 
+   if (defined $status-&gt;{seconds_behind_master} and $status-&gt;{seconds_behind_master} &gt; 0) {
+      $initial_delay = $status-&gt;{seconds_behind_master};
+   }
+
    my $master_dbh;
    if ( $master_dsn ) {
       PTDEBUG &amp;&amp; _d('Connecting to master via DSN from cmd-line');
@@ -4383,7 +4388,7 @@ sub main {
             || $pos-&gt;[$POS] != $res-&gt;{position} )
          {
             push @positions,
-               [ $now, $res-&gt;{file}, $res-&gt;{position} ];
+               [ $now - ( $initial_delay || 0 ), $res-&gt;{file}, $res-&gt;{position} ];
          }
       }
       else {
@@ -4403,7 +4408,7 @@ sub main {
                 # That happened because for an already lagged slave, $now
                 # isn't the correct time, but is actually
                 # $now - $seconds_lagged.
-                 $now - ( $status-&gt;{seconds_behind_master} || 0 ),
+                 $now - ( $initial_delay || 0 ),
                  $status-&gt;{master_log_file},
                  $status-&gt;{read_master_log_pos}
             ];
</pre></body></html>