On Sun, Sep 08, 2019 at 06:47:10PM -0700, Stephen P. Smith wrote:
> As part of a previous patch set, the get_time() function was added to
> date.c eliminating the need to pass a `now` parameter from the test
> code.
I'm glad to see this cleanup. I think it is worth explaining a bit more,
though, why this hunk in particular:
> @@ -103,22 +103,14 @@ static void getnanos(const char **argv)
>
> int cmd__date(int argc, const char **argv)
> {
> - struct timeval now;
> const char *x;
> -
> x = getenv("GIT_TEST_DATE_NOW");
> - if (x) {
> - now.tv_sec = atoi(x);
> - now.tv_usec = 0;
> - }
> - else
> - gettimeofday(&now, NULL);
...is doing the right thing, since it was the site that actually used
the parameters that are being deleted. Maybe something like:
Commit b841d4ff43 (Add `human` format to test-tool, 2019-01-28) added
a get_time() function which allows $GIT_TEST_DATE_NOW in the
environment to override the current time. So we no longer need to
interpret that variable in cmd__date().
Likewise, we can stop passing the "now" parameter down through the
date functions, since nobody uses them. Note that we do need to make
sure all of the previous callers that took a "now" parameter are
correctly using get_time().
which I think explains all of the hunks.
-Peff