On a Server 2022 DC with PS 5.1.20348.859, I had the same problem. It wasn’t an issue of misunderstanding that seconds is the unit of measurement. The Skew variable wasn’t being processed as an integer, so the script was checking … $STRING -gt $INT
and failing.
I forced the Detected Skew in the if statement to be an INT and all is well.
if ( [int]($DetectedSkew.Skew -replace '[^0-9.]') -gt $MaximumSkewInSeconds) {...}