#endif
#ifdef _LIBC
-# define HAVE_LIMITS_H 1
# define STDC_HEADERS 1
#endif
#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
-#if HAVE_LIMITS_H
-# include <limits.h>
-#endif
+#include <limits.h>
#if DEBUG
# include <stdio.h>
# define mktime my_mktime
#endif /* DEBUG */
-#ifndef __P
-# if defined __GNUC__ || (defined __STDC__ && __STDC__)
-# define __P(args) args
-# else
-# define __P(args) ()
-# endif /* GCC. */
-#endif /* Not __P. */
-
-#ifndef CHAR_BIT
-# define CHAR_BIT 8
-#endif
-
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
/* The outer cast is needed to work around a bug in Cray C 5.0.3.0.
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) : (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
-#ifndef INT_MIN
-# define INT_MIN TYPE_MINIMUM (int)
-#endif
-#ifndef INT_MAX
-# define INT_MAX TYPE_MAXIMUM (int)
-#endif
-
#ifndef TIME_T_MIN
# define TIME_T_MIN TYPE_MINIMUM (time_t)
#endif
/* Convert *TP to a time_t value. */
time_t
-mktime (tp)
- struct tm *tp;
+mktime (struct tm *tp)
{
#ifdef _LIBC
/* POSIX.1 8.1.1 requires that whenever mktime() is called, the
#if DEBUG
static int
-not_equal_tm (a, b)
- struct tm *a;
- struct tm *b;
+not_equal_tm (struct tm const *a, struct tm const *b)
{
return ((a->tm_sec ^ b->tm_sec)
| (a->tm_min ^ b->tm_min)
}
static void
-print_tm (tp)
- struct tm *tp;
+print_tm (struct tm const *tp)
{
if (tp)
printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
}
static int
-check_result (tk, tmk, tl, lt)
- time_t tk;
- struct tm tmk;
- time_t tl;
- struct tm *lt;
+check_result (time_t tk, struct tm tmk, time_t tl, struct tm const *lt)
{
if (tk != tl || !lt || not_equal_tm (&tmk, lt))
{
}
int
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int status = 0;
struct tm tm, tmk, tml;
{
tmk = tml = *lt;
tk = mktime (&tmk);
- status |= check_result (tk, tmk, tl, tml);
+ status |= check_result (tk, tmk, tl, &tml);
}
else
{
{
tmk = tml = *lt;
tk = tl;
- status |= check_result (tk, tmk, tl, tml);
+ status |= check_result (tk, tmk, tl, &tml);
}
else
{
\f
/*
Local Variables:
-compile-command: "gcc -DDEBUG -DHAVE_LIMITS_H -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
+compile-command: "gcc -DDEBUG -DSTDC_HEADERS -Wall -W -O -g mktime.c -o mktime"
End:
*/