Re: [RFC/PATCH] date: allow any format to display local time
- From
Jeff King <peff@peff.net>
- Date
- Aug 31, 2015, 18:56 UTC
- Message-ID
- <20150831185657.GC20555@sigill.intra.peff.net>
- In-Reply-To
- <20150831185018.GA20555@sigill.intra.peff.net>
On Mon, Aug 31, 2015 at 02:50:18PM -0400, Jeff King wrote:
Show 24 quoted lines
> diff --git a/fast-import.c b/fast-import.c
> index 6c7c3c9..b19a1b5 100644
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -412,6 +412,10 @@ static void write_crash_report(const char *err)
> struct branch *b;
> unsigned long lu;
> struct recent_command *rc;
> + struct date_mode dm;
> +
> + dm.type = DATE_NORMAL;
> + dm.local = 1;
>
> if (!rpt) {
> error("can't write crash report %s: %s", loc, strerror(errno));
> @@ -424,7 +428,7 @@ static void write_crash_report(const char *err)
> fprintf(rpt, "fast-import crash report:\n");
> fprintf(rpt, " fast-import process: %"PRIuMAX"\n", (uintmax_t) getpid());
> fprintf(rpt, " parent process : %"PRIuMAX"\n", (uintmax_t) getppid());
> - fprintf(rpt, " at %s\n", show_date(time(NULL), 0, DATE_MODE(LOCAL)));
> + fprintf(rpt, " at %s\n", show_date(time(NULL), 0, &dm));
> fputc('\n', rpt);
>
> fputs("fatal: ", rpt);I also considered just switching this hunk to another format. I doubt that anybody cares what format the fast-import crash-report timestamp is in. And in fact LOCAL is kind of a bad choice. Using the user's timezone is fine, but _omitting_ the timezone in a crash report seems like a recipe for confusion. Probably iso8601-local would be saner.
-Peff