void
 InstrStartNode(Instrumentation *instr)
 {
-   if (instr->need_timer)
-   {
-       if (INSTR_TIME_IS_ZERO(instr->starttime))
-           INSTR_TIME_SET_CURRENT(instr->starttime);
-       else
-           elog(ERROR, "InstrStartNode called twice in a row");
-   }
+   if (instr->need_timer &&
+       INSTR_TIME_SET_CURRENT_LAZY(instr->starttime))
+       elog(ERROR, "InstrStartNode called twice in a row");
 
    /* save buffer usage totals at node entry, if needed */
    if (instr->need_bufusage)
 
  *
  * INSTR_TIME_SET_CURRENT(t)       set t to current time
  *
+ * INSTR_TIME_SET_CURRENT_LAZY(t)  set t to current time if t is zero,
+ *                                 evaluates to whether t changed
+ *
  * INSTR_TIME_ADD(x, y)                x += y
  *
  * INSTR_TIME_SUBTRACT(x, y)       x -= y
 
 #endif                         /* WIN32 */
 
+/* same macro on all platforms */
+
+#define INSTR_TIME_SET_CURRENT_LAZY(t) \
+   (INSTR_TIME_IS_ZERO(t) ? INSTR_TIME_SET_CURRENT(t), true : false)
+
 #endif                         /* INSTR_TIME_H */