Skip to content

Instantly share code, notes, and snippets.

@burg
Created October 1, 2014 23:27
Show Gist options
  • Select an option

  • Save burg/96da6776ecd974360e0a to your computer and use it in GitHub Desktop.

Select an option

Save burg/96da6776ecd974360e0a to your computer and use it in GitHub Desktop.
function processRecord(recordPayload, parentRecordPayload)
{
var startTime = recordPayload.startTime;
var endTime = recordPayload.endTime;
// COMPATIBILITY (iOS8): old versions use milliseconds since the epoch, rather
// than seconds elapsed since timeline capturing started. We approximate the latter by
// subtracting the start timestamp, as old versions did not use monotonic times.
if (isNaN(this._legacyFirstRecordTimestamp))
this._legacyFirstRecordTimestamp = recordPayload.startTime;
// If the record's start time sems unreasonably large, treat it as a legacy timestamp.
if (startTime > WebInspector.StartTimeThresholdForLegacyRecordConversion) {
startTime = (startTime - this._legacyFirstRecordTimestamp) / 1000;
endTime = isNaN(endTime) ? NaN : (startTime - this._legacyFirstRecordTimestamp) / 1000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment