bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: test results on MacOS X 10.5


From: Bruno Haible
Subject: Re: test results on MacOS X 10.5
Date: Sun, 11 Apr 2010 22:10:17 +0200
User-agent: KMail/1.9.9

Hi Jim,

Jim Meyering wrote:
> > 000001010000.00 mismatch (-: actual; +:expected)
> > --62167132800
> > +-62167219200
> > FAIL: test-posixtm
> >
> > Jim, what does this mean?
> 
> I suspect that is due to a bug in their mktime function.
> I presume that test is using the system version of mktime,
> and not the gnulib replacement.
> 
> 000001010000.00 is supposed to map to Sat Jan  1 00:00:00 0,
> aka 62167219200 (aka the first second of the year "0"), but they missed
> by 86400 seconds (24 hours) and got Sun Jan  2 00:00:00 0.
> 
> Does that test pass when using our replacement?

In this configuration, it is already using our replacement.

To recap: I'm using MacOS X 10.5.

- When configured in 32-bit mode
     ./configure CPPFLAGS=-Wall
  config.status contains
     S["REPLACE_MKTIME"]="0"
  and the test fails like this:

    skipping 000001010000.00: result is out of range of your time_t
    190112132045.51 return value mismatch: got 0, expected 1
    skipping 190112132045.52: result is out of range of your time_t
    skipping 203801190314.08: result is out of range of your time_t
    skipping 999912312359.59: result is out of range of your time_t
    skipping 6812131415.16: result is out of range of your time_t
    FAIL: test-posixtm

- When configured in 64-bit mode
     ./configure CPPFLAGS=-Wall CC="gcc -arch x86_64" CXX="g++ -arch x86_64"
  config.status contains
     S["REPLACE_MKTIME"]="1"
  and the test fails like this:

    000001010000.00 mismatch (-: actual; +:expected)
    --62167132800
    +-62167219200
    FAIL: test-posixtm

  First reduction: This program
--------------------------------------------------------------------------------------------
#include <config.h>
#include "posixtm.h"
#include <stdio.h>
int main ()
{
  time_t t;
  bool ok = posixtime (&t, "000001010000.00", PDS_SECONDS | PDS_CENTURY | 
PDS_LEADING_YEAR);
  printf ("%ld\n", (long) t);
  return 0;
}
--------------------------------------------------------------------------------------------
  when run as
  $ TZ=UTC0 ./a.out
  produces:
  -62167132800

  Second reduction: This program
--------------------------------------------------------------------------------------------
#include <config.h>
#include <time.h>
#include <stdio.h>
int main ()
{
  static struct tm tm;
  time_t t;

  tm.tm_sec = 0;
  tm.tm_min = 0;
  tm.tm_hour = 0;
  tm.tm_mday = 1;
  tm.tm_mon = 0;
  tm.tm_year = -1900;
  tm.tm_isdst = -1;
  t = mktime (&tm);
  printf ("%ld\n", (long) t);
  return 0;
}
--------------------------------------------------------------------------------------------
  when run as
  $ TZ=UTC0 ./a.out
  produces:
  -62167132800
  (this is with the mktime replacement; with the one from the system it 
produces -1).

So the problem appears really to be with our __mktime_internal.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]