Y2031 problem in tst-fseek.c ...

Dan Kegel dank@kegel.com
Fri Jul 25 04:12:00 GMT 2003


OK, not that this is pressing or anything, but
IIRC in the year 2031, time() will go negative,
and for the next bunch of years, the sequence
    t0 = time(0);
    sleep(1);
    t1 = time(0);
    assert(t1 > t0);
will fail.

That being the case, maybe we should avoid those t1 > t0 style
comparisons now?  A trivial fix might be:

--- glibc-2.2.5/stdio-common/tst-fseek.c.old	Thu Jul 24 20:36:32 2003
+++ glibc-2.2.5/stdio-common/tst-fseek.c	Thu Jul 24 20:37:08 2003
@@ -346,22 +346,22 @@
  	      puts ("fstat64() after fseeko() failed\n");
  	      result = 1;
  	    }
-	  if (st1.st_ctime >= t)
+	  if (st1.st_ctime == t)
  	    {
  	      puts ("st_ctime not updated");
  	      result = 1;
  	    }
-	  if (st1.st_mtime >= t)
+	  if (st1.st_mtime == t)
  	    {
  	      puts ("st_mtime not updated");
  	      result = 1;
  	    }
-	  if (st1.st_ctime >= st2.st_ctime)
+	  if (st1.st_ctime == st2.st_ctime)
  	    {
  	      puts ("st_ctime not changed");
  	      result = 1;
  	    }
-	  if (st1.st_mtime >= st2.st_mtime)
+	  if (st1.st_mtime == st2.st_mtime)
  	    {
  	      puts ("st_mtime not changed");
  	      result = 1;

-- 
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045



More information about the Libc-alpha mailing list