示例#1
0
文件: date.c 项目: Conservatory/quark
int
main (int argc, char **argv)
{
	int i;

	test_init (argc, argv, NULL);

	debug_printf (1, "Good dates:\n");
	for (i = 0; i < G_N_ELEMENTS (good_dates); i++)
		check_good (good_dates[i].format, good_dates[i].date);

	debug_printf (1, "\nOK dates:\n");
	for (i = 0; i < G_N_ELEMENTS (ok_dates); i++)
		check_ok (ok_dates[i], make_date (ok_dates[i]));
	check_ok (TIME_T_STRING, soup_date_new_from_time_t (TIME_T));

	debug_printf (1, "\nBad dates:\n");
	for (i = 0; i < G_N_ELEMENTS (bad_dates); i++)
		check_bad (bad_dates[i], make_date (bad_dates[i]));

	debug_printf (1, "\nConversions:\n");
	for (i = 0; i < G_N_ELEMENTS (conversions); i++)
		check_conversion (&conversions[i] );

	test_cleanup ();
	return errors != 0;
}
示例#2
0
文件: printf.c 项目: 0xffea/MINIX3
static uintmax_t
getuintmax(void)
{
	uintmax_t val;
	char *cp, *ep;

	cp = *gargv;
	if (cp == NULL)
		return 0;
	gargv++;

	if (*cp == '\"' || *cp == '\'')
		return *(cp + 1);

	/* strtoumax won't error -ve values */
	while (isspace(*(unsigned char *)cp))
		cp++;
	if (*cp == '-') {
		warnx("%s: expected positive numeric value", cp);
		rval = 1;
		return 0;
	}

	errno = 0;
	val = strtoul(cp, &ep, 0);
	check_conversion(cp, ep);
	return val;
}
示例#3
0
    template <> inline double
    Config::from_config (const std::string& value)
    {
        const char* str    = value.c_str();
        double      ret;
        const char* endptr = gu_str2dbl (str, &ret);

        check_conversion (str, endptr, "double");

        return ret;
    }
示例#4
0
    template <> inline void*
    Config::from_config (const std::string& value)
    {
        const char* str    = value.c_str();
        void*       ret;
        const char* endptr = gu_str2ptr (str, &ret);

        check_conversion (str, endptr, "pointer");

        return ret;
    }
示例#5
0
    template <> inline bool
    Config::from_config (const std::string& value)
    {
        const char* str    = value.c_str();
        bool        ret;
        const char* endptr = gu_str2bool (str, &ret);

        check_conversion (str, endptr, "boolean");

        return ret;
    }
示例#6
0
文件: printf.c 项目: 0xffea/MINIX3
static double
getdouble(void)
{
	double val;
	char *ep;

	if (!*gargv)
		return (0.0);

	if (**gargv == '\"' || **gargv == '\'')
		return (double) *((*gargv++)+1);

	errno = 0;
	val = strtod(*gargv, &ep);
	check_conversion(*gargv++, ep);
	return val;
}
示例#7
0
static long
getlong(void)
{
	long val;
	char *ep;

	if (!*gargv)
		return(0L);

	if (**gargv == '\"' || **gargv == '\'')
		return (long) *((*gargv++)+1);

	errno = 0;
	val = strtol (*gargv, &ep, 0);
	check_conversion(*gargv++, ep);
	return val;
}
示例#8
0
static unsigned long
getulong(void)
{
	unsigned long val;
	char *ep;

	if (!*gargv)
		return(0UL);

	if (**gargv == '\"' || **gargv == '\'')
		return (unsigned long) *((*gargv++)+1);

	errno = 0;
	val = strtoul (*gargv, &ep, 0);
	check_conversion(*gargv++, ep);
	return val;
}
示例#9
0
    /*! Convert string configuration values to other types.
     *  General template for integers, specialized templates follow below. */
    template <typename T> static inline T
    from_config (const std::string& value)
    {
        const char* str    = value.c_str();
        long long   ret;
        const char* endptr = gu_str2ll (str, &ret);

        check_conversion (str, endptr, "integer");

        switch (sizeof(T))
        {
        case 1: return overflow_char  (ret);
        case 2: return overflow_short (ret);
        case 4: return overflow_int   (ret);
		case 8: return overflow_longlong   (ret);
        }

        return ret;
    }
示例#10
0
static double
getdouble(void)
{
	double val;
	char *cp, *ep;

	cp = *gargv;
	if (cp == NULL)
		return 0;
	gargv++;

	if (*cp == '\"' || *cp == '\'')
		return (unsigned char) cp[1];

	errno = 0;
	val = strtod(cp, &ep);
	check_conversion(cp, ep);
	return val;
}
示例#11
0
文件: printf.c 项目: 0xffea/MINIX3
static intmax_t
getintmax(void)
{
	intmax_t val;
	char *cp, *ep;

	cp = *gargv;
	if (cp == NULL)
		return 0;
	gargv++;

	if (*cp == '\"' || *cp == '\'')
		return *(cp+1);

	errno = 0;
	val = strtol(cp, &ep, 0);
	check_conversion(cp, ep);
	return val;
}
示例#12
0
文件: c.c 项目: dileepk/adc
void main()
{
unsigned int a=0,i;
while(1)
{
for(i=0;i<1000;i++);
init();
start_conversion();
while(check_conversion());
a=ADC10MEM;
if(a>407)
{
ADC10CTL0&=~(1<<1);
ADC10AE0=0;
P1DIR=1;
P1OUT=1;}
else 
P1OUT=0;
}
}
示例#13
0
void			check_action(char **s)
{
	char	sc[2];

	++(*s);
	while ((flags(s) || modifiers(s)))
		++(*s);
	if (**s)
	{
		if (check_conversion(s) == false)
		{
			sc[0] = **s;
			sc[1] = '\0';
			sgt_printf()->flags.prec = -1;
			to_string(ft_strdup(sc));
		}
	}
	else
		--(*s);
}
示例#14
0
static uintmax_t
getuintmax(void)
{
	uintmax_t val = 0;
	char *cp, *ep;

	cp = *gargv;
	if (cp == NULL)
		goto out;
	gargv++;

	val = (unsigned char) cp[1];
	if (*cp == '\"' || *cp == '\'')
		goto out;

	errno = 0;
	val = strtoumax(cp, &ep, 0);
	check_conversion(cp, ep);
out:
	return val;
}
示例#15
0
文件: printf.c 项目: 0xffea/MINIX3
static int
getwidth(void)
{
	long val;
	char *s, *ep;

	s = *gargv;
	if (!*gargv)
		return (0);
	gargv++;

	errno = 0;
	val = strtoul(s, &ep, 0);
	check_conversion(s, ep);

	/* Arbitrarily 'restrict' field widths to 1Mbyte */
	if (val < 0 || val > 1 << 20) {
		warnx("%s: invalid field width", s);
		return 0;
	}

	return val;
}
示例#16
0
void check_computed_goto(expression e)
{
  /* Rather weak check (same as gcc) */
  check_conversion(ptr_void_type, e->type);
}
示例#17
0
文件: main.cpp 项目: dmilos/color
int main(int argc, char const *argv[])
 {
  print< ::color::rgb< ::color::type::split422_t >::category_type  >();
  print< ::color::rgb< ::color::type::split242_t >::category_type  >();
  print< ::color::rgb< ::color::type::split224_t >::category_type  >();

  print< ::color::bgr< ::color::type::split422_t >::category_type  >();
  print< ::color::bgr< ::color::type::split242_t >::category_type  >();
  print< ::color::bgr< ::color::type::split224_t >::category_type  >();

  print< ::color::abgr< ::color::type::split2AAA_t >::category_type  >();
  print< ::color::bgra< ::color::type::splitAAA2_t >::category_type  >();

  print< ::color::rgba< ::color::type::splitAAA2_t >::category_type  >();
  print< ::color::argb< ::color::type::split2AAA_t >::category_type  >();

  sandbox_test();

  extern void test_constant();
  test_constant();

  extern void check_sizeof();
  check_sizeof();

  void test_operation();
  test_operation();

  void image_conversion();
  image_conversion();

  test_pallete();

  ctor_test();

  void main_place();
  main_place();

  void check_get();
  check_get();

  extern int gray_test( int argc, char const *argv[] );
  gray_test( argc, argv );

  extern int decompose_test( int argc, char const *argv[] );
  decompose_test( argc, argv );

  extern void print_bound();
  print_bound();

  make_blue();

  invoke();

  extern void check_conversion();
  check_conversion();

  void make_test_gray_scale();
  make_test_gray_scale();

  void test_set_invoke();
  test_set_invoke();

  void test_get_invoke( double value );
  test_get_invoke(0.5);

  return 0;
 }
示例#18
0
/* Return TRUE if no error and lhstype and rhstype are not error_type */
bool check_assignment(type lhstype, type rhstype, expression rhs,
		      const char *context, data_declaration fundecl,
		      const char *funname, int parmnum)
{
  bool zerorhs = rhs && definite_zero(rhs);

  if (lhstype == error_type || rhstype == error_type)
    return FALSE;

  if (type_void(rhstype))
    {
      error("void value not ignored as it ought to be");
      return FALSE;
    }

  if (type_equal_unqualified(lhstype, rhstype))
    return TRUE;

  if (type_arithmetic(lhstype) && type_arithmetic(rhstype))
    {
      if (rhs)
	constant_overflow_warning(rhs->cst);
      return check_conversion(lhstype, rhstype);
    }
  if (parmnum && (type_qualifiers(lhstype) & transparent_qualifier))
    {
      /* See if we can match any field of lhstype */
      tag_declaration tag = type_tag(lhstype);
      field_declaration fields, marginal_field = NULL;

      /* I blame gcc for this horrible mess (and it's minor inconsistencies
	 with the regular rules) */
      /* pedantic warnings are skipped in here because we're already
	 issuing a warning for the use of this construct */
      for (fields = tag->fieldlist; fields; fields = fields->next)
	{
	  type ft = fields->type;

	  if (type_compatible(ft, rhstype))
	    break;

	  if (!type_pointer(ft))
	    continue;

	  if (type_pointer(rhstype))
	    {
	      type ttl = type_points_to(ft), ttr = type_points_to(rhstype);
	      bool goodmatch = assignable_pointer_targets(ttl, ttr, FALSE);

	      /* Any non-function converts to a [const][volatile] void *
		 and vice versa; otherwise, targets must be the same.
		 Meanwhile, the lhs target must have all the qualifiers of
		 the rhs.  */
	      if (goodmatch)
		{
		  /* If this type won't generate any warnings, use it.  */
		  if ((type_function(ttr) && type_function(ttl))
		      ? (((!type_const(ttl)) | type_const(ttr))
			 & ((!type_volatile(ttl)) | type_volatile(ttr)))
		      : (((type_const(ttl)) | (!type_const(ttr)))
			 & (type_volatile(ttl) | (!type_volatile(ttr)))))
		    break;

		  /* Keep looking for a better type, but remember this one.  */
		  if (!marginal_field)
		    marginal_field = fields;
		}
	    }

	  /* Can convert integer zero to any pointer type.  */
	  /* Note that this allows passing *any* null pointer (gcc bug?) */
	  if (zerorhs)
	    break;
	}

      if (fields || marginal_field)
	{
	  if (!fields)
	    {
	      /* We have only a marginally acceptable member type;
		 it needs a warning.  */
	      type ttl = type_points_to(marginal_field->type),
		ttr = type_points_to(rhstype);

	      ptrconversion_warnings(ttl, ttr, rhs, context, funname, parmnum,
				     FALSE);
	    }
	  
	  if (pedantic && !(fundecl && fundecl->in_system_header))
	    pedwarn("ANSI C prohibits argument conversion to union type");

	  return TRUE;
	}
    }

  if (type_pointer(lhstype) && type_pointer(rhstype))
    {
      type ttl = type_points_to(lhstype), ttr = type_points_to(rhstype);
      bool goodmatch = assignable_pointer_targets(ttl, ttr, pedantic);

      /* Any non-function converts to a [const][volatile] void *
	 and vice versa; otherwise, targets must be the same.
	 Meanwhile, the lhs target must have all the qualifiers of the rhs.  */
      if (goodmatch || (type_equal_unqualified(make_unsigned_type(ttl),
					       make_unsigned_type(ttr))))
	ptrconversion_warnings(ttl, ttr, rhs, context, funname, parmnum,
			       pedantic);
      else
	warn_for_assignment("%s from incompatible pointer type",
			    context, funname, parmnum);

      return check_conversion(lhstype, rhstype);
    }
  /* enum = ptr and ptr = enum counts as an error, so use type_integral */
  else if (type_pointer(lhstype) && type_integral(rhstype))
    {
      if (!zerorhs)
	warn_for_assignment("%s makes pointer from integer without a cast",
			    context, funname, parmnum);
      return check_conversion(lhstype, rhstype);
    }
  else if (type_integral(lhstype) && type_pointer(rhstype))
    {
      warn_for_assignment("%s makes integer from pointer without a cast",
			  context, funname, parmnum);
      return check_conversion(lhstype, rhstype);
    }

  if (!context)
    if (funname)
      error("incompatible type for argument %d of `%s'", parmnum, funname);
    else
      error("incompatible type for argument %d of indirect function call",
	    parmnum);
  else
    error("incompatible types in %s", context);

  return FALSE;
}
示例#19
0
expression make_cast(location loc, asttype t, expression e)
{
  expression result = CAST(expression, new_cast(parse_region, loc, e, t));
  type castto = t->type;
  
  if (castto == error_type || type_void(castto))
    ; /* Do nothing */
  else if (type_array(castto))
    {
      error("cast specifies array type");
      castto = error_type;
    }
  else if (type_function(castto))
    {
      error("cast specifies function type");
      castto = error_type;
    }
  else if (type_equal_unqualified(castto, e->type))
    {
      if (pedantic && type_aggregate(castto))
	pedwarn("ANSI C forbids casting nonscalar to the same type");
    }
  else
    {
      type etype = e->type;

      /* Convert functions and arrays to pointers,
	 but don't convert any other types.  */
      if (type_function(etype) || type_array(etype))
	etype = default_conversion(e);

      if (type_union(castto))
	{
	  tag_declaration utag = type_tag(castto);
	  field_declaration ufield;

	  /* Look for etype as a field of the union */
	  for (ufield = utag->fieldlist; ufield; ufield = ufield->next)
	    if (ufield->name && type_equal_unqualified(ufield->type, etype))
	      {
		if (pedantic)
		  pedwarn("ANSI C forbids casts to union type");
		break;
	      }
	  if (!ufield)
	    error("cast to union type from type not present in union");
	}
      else 
	{
	  /* Optionally warn about potentially worrisome casts.  */

	  if (warn_cast_qual && type_pointer(etype) && type_pointer(castto))
	    {
	      type ep = type_points_to(etype), cp = type_points_to(castto);

	      if (type_volatile(ep) && !type_volatile(cp))
		pedwarn("cast discards `volatile' from pointer target type");
	      if (type_const(ep) && !type_const(cp))
		pedwarn("cast discards `const' from pointer target type");
	    }

	  /* This warning is weird */
	  if (warn_bad_function_cast && is_function_call(e) &&
	      !type_equal_unqualified(castto, etype))
	    warning ("cast does not match function type");

#if 0
	  /* Warn about possible alignment problems.  */
	  if (STRICT_ALIGNMENT && warn_cast_align
	      && TREE_CODE (type) == POINTER_TYPE
	      && TREE_CODE (otype) == POINTER_TYPE
	      && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
	      && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
	      /* Don't warn about opaque types, where the actual alignment
		 restriction is unknown.  */
	      && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE
		    || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE)
		   && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)
	      && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
	    warning ("cast increases required alignment of target type");

	  if (TREE_CODE (type) == INTEGER_TYPE
	      && TREE_CODE (otype) == POINTER_TYPE
	      && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
	      && !TREE_CONSTANT (value))
	    warning ("cast from pointer to integer of different size");

	  if (TREE_CODE (type) == POINTER_TYPE
	      && TREE_CODE (otype) == INTEGER_TYPE
	      && TYPE_PRECISION (type) != TYPE_PRECISION (otype)
#if 0
	      /* Don't warn about converting 0 to pointer,
		 provided the 0 was explicit--not cast or made by folding.  */
	      && !(TREE_CODE (value) == INTEGER_CST && integer_zerop (value))
#endif
	      /* Don't warn about converting any constant.  */
	      && !TREE_CONSTANT (value))
	    warning ("cast to pointer from integer of different size");
#endif

	  check_conversion(castto, etype);
	}
    }

  result->lvalue = !pedantic && e->lvalue;
  result->isregister = e->isregister;
  result->bitfield = e->bitfield;
  result->static_address = e->static_address;
  result->type = castto;
  result->cst = fold_cast(result);

  return result;
}
示例#20
0
static void
run_test (void)
{
    Timespec ts;
    int i;
    gboolean do_print = FALSE;

    /* Now leaving the 60's:
     *
     * Black Panthers
     * Weather Underground
     * Kent State
     * Evacuation of Vietnam
     * Impeachment
     * Gas Crisis
     * New York Garbage Crisis
     * Stagflation
     * Delapidated Bicentennial
     * Sex Pistols
     * Punk Rock
     *
     * Of course, anything had to be better than the miserable 70's,
     * which explains why Reagan was elected.  Food for thought.
     */
    ts.tv_sec = 10 * 365 * 24 * 3600 + 2 * 24 * 3600;
    ts.tv_nsec = 0;
    check_conversion ("1979-12-31 15:00:00.000000 -0900", ts);
    check_conversion ("1979-12-31 16:00:00.000000 -0800", ts);
    check_conversion ("1979-12-31 17:00:00.000000 -0700", ts);
    check_conversion ("1979-12-31 18:00:00.000000 -0600", ts);
    check_conversion ("1979-12-31 19:00:00.000000 -0500", ts);
    check_conversion ("1979-12-31 20:00:00.000000 -0400", ts);
    check_conversion ("1979-12-31 21:00:00.000000 -0300", ts);
    check_conversion ("1979-12-31 22:00:00.000000 -0200", ts);
    check_conversion ("1979-12-31 23:00:00.000000 -0100", ts);

    check_conversion ("1980-01-01 00:00:00.000000 -0000", ts);
    check_conversion ("1980-01-01 00:00:00.000000 +0000", ts);

    check_conversion ("1980-01-01 01:00:00.000000 +0100", ts);
    check_conversion ("1980-01-01 02:00:00.000000 +0200", ts);
    check_conversion ("1980-01-01 03:00:00.000000 +0300", ts);
    check_conversion ("1980-01-01 04:00:00.000000 +0400", ts);
    check_conversion ("1980-01-01 05:00:00.000000 +0500", ts);
    check_conversion ("1980-01-01 06:00:00.000000 +0600", ts);
    check_conversion ("1980-01-01 07:00:00.000000 +0700", ts);
    check_conversion ("1980-01-01 08:00:00.000000 +0800", ts);

    /* check minute-offsets as well */
    check_conversion ("1980-01-01 08:01:00.000000 +0801", ts);
    check_conversion ("1980-01-01 08:02:00.000000 +0802", ts);
    check_conversion ("1980-01-01 08:03:00.000000 +0803", ts);
    check_conversion ("1980-01-01 08:23:00.000000 +0823", ts);
    check_conversion ("1980-01-01 08:35:00.000000 +0835", ts);
    check_conversion ("1980-01-01 08:47:00.000000 +0847", ts);
    check_conversion ("1980-01-01 08:59:00.000000 +0859", ts);

    check_conversion ("1979-12-31 15:01:00.000000 -0859", ts);
    check_conversion ("1979-12-31 15:02:00.000000 -0858", ts);
    check_conversion ("1979-12-31 15:03:00.000000 -0857", ts);
    check_conversion ("1979-12-31 15:23:00.000000 -0837", ts);
    check_conversion ("1979-12-31 15:45:00.000000 -0815", ts);


    /* The 90's */
    ts.tv_sec = 20 * 365 * 24 * 3600 + 5 * 24 * 3600;
    ts.tv_nsec = 0;
    check_conversion ("1989-12-31 15:00:00.000000 -0900", ts);
    check_conversion ("1989-12-31 16:00:00.000000 -0800", ts);
    check_conversion ("1989-12-31 17:00:00.000000 -0700", ts);
    check_conversion ("1989-12-31 18:00:00.000000 -0600", ts);
    check_conversion ("1989-12-31 19:00:00.000000 -0500", ts);
    check_conversion ("1989-12-31 20:00:00.000000 -0400", ts);
    check_conversion ("1989-12-31 21:00:00.000000 -0300", ts);
    check_conversion ("1989-12-31 22:00:00.000000 -0200", ts);
    check_conversion ("1989-12-31 23:00:00.000000 -0100", ts);

    check_conversion ("1990-01-01 00:00:00.000000 -0000", ts);
    check_conversion ("1990-01-01 00:00:00.000000 +0000", ts);

    check_conversion ("1990-01-01 01:00:00.000000 +0100", ts);
    check_conversion ("1990-01-01 02:00:00.000000 +0200", ts);
    check_conversion ("1990-01-01 03:00:00.000000 +0300", ts);
    check_conversion ("1990-01-01 04:00:00.000000 +0400", ts);
    check_conversion ("1990-01-01 05:00:00.000000 +0500", ts);
    check_conversion ("1990-01-01 06:00:00.000000 +0600", ts);
    check_conversion ("1990-01-01 07:00:00.000000 +0700", ts);
    check_conversion ("1990-01-01 08:00:00.000000 +0800", ts);

    /* check minute-offsets as well */
    check_conversion ("1990-01-01 08:01:00.000000 +0801", ts);
    check_conversion ("1990-01-01 08:02:00.000000 +0802", ts);
    check_conversion ("1990-01-01 08:03:00.000000 +0803", ts);
    check_conversion ("1990-01-01 08:23:00.000000 +0823", ts);
    check_conversion ("1990-01-01 08:35:00.000000 +0835", ts);
    check_conversion ("1990-01-01 08:47:00.000000 +0847", ts);
    check_conversion ("1990-01-01 08:59:00.000000 +0859", ts);

    check_conversion ("1989-12-31 15:01:00.000000 -0859", ts);
    check_conversion ("1989-12-31 15:02:00.000000 -0858", ts);
    check_conversion ("1989-12-31 15:03:00.000000 -0857", ts);
    check_conversion ("1989-12-31 15:23:00.000000 -0837", ts);
    check_conversion ("1989-12-31 15:45:00.000000 -0815", ts);


    /* The naughties */
    ts.tv_sec = 30 * 365 * 24 * 3600 + 7 * 24 * 3600;
    ts.tv_nsec = 0;
    check_conversion ("1999-12-31 15:00:00.000000 -0900", ts);
    check_conversion ("1999-12-31 16:00:00.000000 -0800", ts);
    check_conversion ("1999-12-31 17:00:00.000000 -0700", ts);
    check_conversion ("1999-12-31 18:00:00.000000 -0600", ts);
    check_conversion ("1999-12-31 19:00:00.000000 -0500", ts);
    check_conversion ("1999-12-31 20:00:00.000000 -0400", ts);
    check_conversion ("1999-12-31 21:00:00.000000 -0300", ts);
    check_conversion ("1999-12-31 22:00:00.000000 -0200", ts);
    check_conversion ("1999-12-31 23:00:00.000000 -0100", ts);

    check_conversion ("2000-01-01 00:00:00.000000 -0000", ts);
    check_conversion ("2000-01-01 00:00:00.000000 +0000", ts);

    check_conversion ("2000-01-01 01:00:00.000000 +0100", ts);
    check_conversion ("2000-01-01 02:00:00.000000 +0200", ts);
    check_conversion ("2000-01-01 03:00:00.000000 +0300", ts);
    check_conversion ("2000-01-01 04:00:00.000000 +0400", ts);
    check_conversion ("2000-01-01 05:00:00.000000 +0500", ts);
    check_conversion ("2000-01-01 06:00:00.000000 +0600", ts);
    check_conversion ("2000-01-01 07:00:00.000000 +0700", ts);
    check_conversion ("2000-01-01 08:00:00.000000 +0800", ts);

    /* check minute-offsets as well */
    check_conversion ("2000-01-01 08:01:00.000000 +0801", ts);
    check_conversion ("2000-01-01 08:02:00.000000 +0802", ts);
    check_conversion ("2000-01-01 08:03:00.000000 +0803", ts);
    check_conversion ("2000-01-01 08:23:00.000000 +0823", ts);
    check_conversion ("2000-01-01 08:35:00.000000 +0835", ts);
    check_conversion ("2000-01-01 08:47:00.000000 +0847", ts);
    check_conversion ("2000-01-01 08:59:00.000000 +0859", ts);

    check_conversion ("1999-12-31 15:01:00.000000 -0859", ts);
    check_conversion ("1999-12-31 15:02:00.000000 -0858", ts);
    check_conversion ("1999-12-31 15:03:00.000000 -0857", ts);
    check_conversion ("1999-12-31 15:23:00.000000 -0837", ts);
    check_conversion ("1999-12-31 15:45:00.000000 -0815", ts);


    /* The nows */
    ts.tv_sec = 35 * 365 * 24 * 3600 + 9 * 24 * 3600;
    ts.tv_nsec = 0;
    check_conversion ("2004-12-31 15:00:00.000000 -0900", ts);
    check_conversion ("2004-12-31 16:00:00.000000 -0800", ts);
    check_conversion ("2004-12-31 17:00:00.000000 -0700", ts);
    check_conversion ("2004-12-31 18:00:00.000000 -0600", ts);
    check_conversion ("2004-12-31 19:00:00.000000 -0500", ts);
    check_conversion ("2004-12-31 20:00:00.000000 -0400", ts);
    check_conversion ("2004-12-31 21:00:00.000000 -0300", ts);
    check_conversion ("2004-12-31 22:00:00.000000 -0200", ts);
    check_conversion ("2004-12-31 23:00:00.000000 -0100", ts);

    check_conversion ("2005-01-01 00:00:00.000000 -0000", ts);
    check_conversion ("2005-01-01 00:00:00.000000 +0000", ts);

    check_conversion ("2005-01-01 01:00:00.000000 +0100", ts);
    check_conversion ("2005-01-01 02:00:00.000000 +0200", ts);
    check_conversion ("2005-01-01 03:00:00.000000 +0300", ts);
    check_conversion ("2005-01-01 04:00:00.000000 +0400", ts);
    check_conversion ("2005-01-01 05:00:00.000000 +0500", ts);
    check_conversion ("2005-01-01 06:00:00.000000 +0600", ts);
    check_conversion ("2005-01-01 07:00:00.000000 +0700", ts);
    check_conversion ("2005-01-01 08:00:00.000000 +0800", ts);

    /* check minute-offsets as well */
    check_conversion ("2005-01-01 08:01:00.000000 +0801", ts);
    check_conversion ("2005-01-01 08:02:00.000000 +0802", ts);
    check_conversion ("2005-01-01 08:03:00.000000 +0803", ts);
    check_conversion ("2005-01-01 08:23:00.000000 +0823", ts);
    check_conversion ("2005-01-01 08:35:00.000000 +0835", ts);
    check_conversion ("2005-01-01 08:47:00.000000 +0847", ts);
    check_conversion ("2005-01-01 08:59:00.000000 +0859", ts);

    check_conversion ("2004-12-31 15:01:00.000000 -0859", ts);
    check_conversion ("2004-12-31 15:02:00.000000 -0858", ts);
    check_conversion ("2004-12-31 15:03:00.000000 -0857", ts);
    check_conversion ("2004-12-31 15:23:00.000000 -0837", ts);
    check_conversion ("2004-12-31 15:45:00.000000 -0815", ts);


    /* Various leap-year days and near-leap times. */
    ts = gnc_iso8601_to_timespec_gmt ("1980-02-29 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("1979-02-28 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("1990-02-28 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2000-02-29 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2004-02-29 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2008-02-29 00:00:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2008-02-29 00:01:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2008-02-29 02:02:00.000000 -0000");
    check_time (ts, do_print);

    ts = gnc_iso8601_to_timespec_gmt ("2008-02-28 23:23:23.000000 -0000");
    check_time (ts, do_print);

    /* Here's a date ten days after the 2038 rollover that should work
       if/when we support it. */
    ts.tv_nsec = 0;
    ts.tv_sec = (long long int) 0x7fffffff + 3600 * 24 * 10;
    check_time(ts, do_print);

    /* Various 'special' times. What makes these so special? */
    ts.tv_sec = 152098136;
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1162088421;
    ts.tv_nsec = 12548000;
    check_time (ts, do_print);

    ts.tv_sec = 325659000 - 6500;
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1143943200;
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1603591171;
    ts.tv_nsec = 595311000;
    check_time (ts, do_print);

    ts.tv_sec = 1738909365;
    ts.tv_nsec = 204102000;
    check_time (ts, do_print);

    ts.tv_sec = 1603591171;
    ts.tv_nsec = 595311000;
    check_time (ts, do_print);

    ts.tv_sec = 1143943200 - 1;
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1143943200;
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1143943200 + (7 * 60 * 60);
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts.tv_sec = 1143943200 + (8 * 60 * 60);
    ts.tv_nsec = 0;
    check_time (ts, do_print);

    ts = *get_random_timespec ();

    for (i = 0; i < 10000; i++)
    {
        ts.tv_sec += 10800;
        if (!check_time (ts, FALSE))
            return;
    }

    for (i = 0; i < 5000; i++)
    {
        ts = *get_random_timespec ();

        if (!check_time (ts, FALSE))
            return;
    }
}