git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Fix approxidate("never") to always return 0

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jun 18, 2008, 15:06 UTC
Message-ID
<alpine.DEB.1.00.0806181550190.6439@racer>
In-Reply-To
<1213720497-9093-1-git-send-email-dkr+ml.git@free.fr>
Hi,
On Tue, 17 Jun 2008, Olivier Marin wrote:
Show 14 quoted lines
> diff --git a/date.c b/date.c
> index a74ed86..1a4eb87 100644
> --- a/date.c
> +++ b/date.c
> @@ -682,10 +682,8 @@ static void date_am(struct tm *tm, int *num)
>  
>  static void date_never(struct tm *tm, int *num)
>  {
> -	tm->tm_mon = tm->tm_wday = tm->tm_yday
> -		= tm->tm_hour = tm->tm_min = tm->tm_sec = 0;
> -	tm->tm_year = 70;
> -	tm->tm_mday = 1;
> +	time_t n = 0;
> +	localtime_r(&n, tm);

I would have reused local_tzoffset() and been explicit about the used date, but your version is shorter.

Ciao, Dscho

Previous: Olivier Marin
Message 3 of 3 in “Bug with approxidate("never")?”
  1. Olivier MarinJun 15, 2008
  2. Fix approxidate("never") to always return 0Olivier Marin, Jun 17, 2008
  3. Johannes SchindelinJun 18, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.