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

[PATCH] Accept dates before 2000/01/01 when specified as seconds since the epoch

From
Johannes Sixt <johannes.sixt@telecom.at>
Date
Jun 6, 2007, 08:11 UTC
Message-ID
<11811175153355-git-send-email-johannes.sixt@telecom.at>

Tests with git-filter-branch on a repository that was converted from CVS and that has commits reaching back to 1999 revealed that it is necessary to parse dates before 2000/01/01 when they are specified as seconds since 1970/01/01. There is now still a limit, 100000000, which is 1973/03/03 09:46:40 UTC, in order to allow that dates are represented as 8 digits.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
---
 date.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/date.c b/date.c
index a9b59a2..4690371 100644
--- a/date.c
+++ b/date.c
@@ -414,9 +414,11 @@ static int match_digit(const char *date, struct tm *tm, int *offset, int *tm_gmt
 	num = strtoul(date, &end, 10);
 
 	/*
-	 * Seconds since 1970? We trigger on that for anything after Jan 1, 2000
+	 * Seconds since 1970? We trigger on that for any numbers with
+	 * more than 8 digits. This is because we don't want to rule out
+	 * numbers like 20070606 as a YYYYMMDD date.
 	 */
-	if (num > 946684800) {
+	if (num >= 100000000) {
 		time_t time = num;
 		if (gmtime_r(&time, tm)) {
 			*tm_gmt = 1;
-- 
1.5.2.1.120.gd732
Next: Junio C Hamano
Message 1 of 6 in “Accept dates before 2000/01/01 when specified as seconds since the epoch”
  1. Accept dates before 2000/01/01 when specified as seconds since the epochJohannes Sixt, Jun 6, 2007
  2. Junio C HamanoJun 6, 2007
  3. Johannes SixtJun 6, 2007
  4. Sam VilainJun 7, 2007
  5. Junio C HamanoJun 7, 2007
  6. Johannes SchindelinJun 7, 2007

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.