files/en-us/web/api/performanceentry/starttime/index.md
{{APIRef("Performance API")}}{{AvailableInWorkers}}
The read-only startTime property returns the first {{domxref("DOMHighResTimeStamp","timestamp", "", "no-code")}} recorded for this {{domxref("PerformanceEntry")}}. The meaning of this property depends on the value of this entry's {{domxref("PerformanceEntry.entryType", "entryType")}}.
A {{domxref("DOMHighResTimeStamp")}} representing the first timestamp when the {{domxref("PerformanceEntry")}} was created.
The meaning of this property depends on the value of this performance entry's {{domxref("PerformanceEntry.entryType","entryType")}}:
element
0, otherwise the value of this entry's {{domxref("PerformanceElementTiming.loadTime", "loadTime")}}.event
timeStamp property.first-input
timeStamp.largest-contentful-paint
0, otherwise the value of this entry's {{domxref("LargestContentfulPaint.loadTime", "loadTime")}}.layout-shift
longtask
mark
measure
navigation
0.paint
resource
taskattribution
0.visibility-state
The following example shows the use of the startTime property which you can log during performance observation.
Note: The {{domxref("performance.mark()")}} method allows you to set your own startTime, and the {{domxref("performance.measure()")}} method allows to set the start of the measure.
performance.mark("my-mark");
performance.mark("my-other-mark", { startTime: 12.5 });
loginButton.addEventListener("click", (clickEvent) => {
performance.measure("login-click", { start: clickEvent.timeStamp });
});
function perfObserver(list, observer) {
list.getEntries().forEach((entry) => {
if (entry.entryType === "mark") {
console.log(`${entry.name}'s startTime: ${entry.startTime}`);
}
if (entry.entryType === "measure") {
console.log(`${entry.name}'s duration: ${entry.duration}`);
}
});
}
const observer = new PerformanceObserver(perfObserver);
observer.observe({ entryTypes: ["measure", "mark"] });
{{Specifications}}
{{Compat}}