From: Jeff Hostetler Date: Thu, 20 Oct 2022 20:52:51 GMT Subject: Re: [PATCH v3 7/8] trace2: add stopwatch timers Message-ID: In-Reply-To: On 10/20/22 4:25 PM, Junio C Hamano wrote: > "Jeff Hostetler via GitGitGadget" writes: > >> +#define NS_PER_SEC_D ((double)1000*1000*1000) >> ... >> + double t_total = ((double)timer->total_ns) / NS_PER_SEC_D; >> + double t_min = ((double)timer->min_ns) / NS_PER_SEC_D; >> + double t_max = ((double)timer->max_ns) / NS_PER_SEC_D; > > Hmph, it certainly is an improvement compared to the previous round, > but was there a reason why we did not want a more concise > > #define NS_TO_SECONDS(ns) ((double)(ns) / (1000*1000*1000.)) > > double t_total = NS_TO_SECONDS(timer->total_ns); > double t_min = NS_TO_SECONDS(timer->min_ns); > double t_max = NS_TO_SECONDS(timer->max_ns); > > that does not need to repeat (double) all over? > > Not worth a reroll by itself. Just wanted to know the reasoning > behind it, as I suspect I am missing the reason why it is good to > explicitly casting with (double) in some places; the above does not > look like one, though. > > Thanks. > um, it never occurred to me to make it a macro with an arg. i just did a search/replace on the inline constant. you're right though. your version is much shorter. i'll reroll tomorrow with the typo that AEvar found. Thanks Jeff