Skip to content

Commit bced49c

Browse files
author
Michael Mrowetz
committed
#172 round entry data during conversion
1 parent 10406a4 commit bced49c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: src/ts/transformers/har.ts

+7-6
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ export function transformDoc(harData: Har): WaterfallDocs {
5050
* @param {boolean} isTLS
5151
*/
5252
function toWaterFallEntry(entry: Entry, index: number, startRelative: number, isTLS: boolean) {
53-
const endRelative = toInt(entry._all_end) || (startRelative + entry.time);
53+
startRelative = Math.round(startRelative);
54+
const endRelative = Math.round(toInt(entry._all_end) || (startRelative + entry.time));
5455
const requestType = mimeToRequestType(entry.response.content.mimeType);
5556
const indicators = collectIndicators(entry, isTLS, requestType);
5657
const responseDetails = createResponseDetails(entry, indicators);
@@ -168,11 +169,11 @@ function buildDetailTimingBlocks(startRelative: number, harEntry: Entry): Waterf
168169
const sslEnd = parseInt(harEntry[`_ssl_end`], 10) || time.start + t.ssl;
169170
const connectStart = (!!parseInt(harEntry[`_ssl_start`], 10)) ? time.start : sslEnd;
170171
return collect
171-
.concat([createWaterfallEntryTiming("ssl", sslStart, sslEnd)])
172-
.concat([createWaterfallEntryTiming(key, connectStart, time.end)]);
172+
.concat([createWaterfallEntryTiming("ssl", Math.round(sslStart), Math.round(sslEnd))])
173+
.concat([createWaterfallEntryTiming(key, Math.round(connectStart), Math.round(time.end))]);
173174
}
174175

175-
return collect.concat([createWaterfallEntryTiming(key, time.start, time.end)]);
176+
return collect.concat([createWaterfallEntryTiming(key, Math.round(time.start), Math.round(time.end))]);
176177
}, []);
177178
}
178179

@@ -199,8 +200,8 @@ function getTimePair(key: string, harEntry: Entry, collect: WaterfallEntryTiming
199200
const end = isNaN(preciseEnd) ? (start + harEntry.timings[key]) : preciseEnd;
200201

201202
return {
202-
"end": end,
203-
"start": start,
203+
"end": Math.round(end),
204+
"start": Math.round(start),
204205
};
205206
}
206207

0 commit comments

Comments
 (0)