about summary refs log tree commit diff
path: root/time
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-06-02 18:50:07 +0000
committerRoland McGrath <roland@gnu.org>1996-06-02 18:50:07 +0000
commit847242451c6e53156abead29aa47a3f56cfcc928 (patch)
treef036468f962f47af250a95e84633319dd5653a16 /time
parent76060ec0b8b5d6f0a860a94f100dc6e48041bac3 (diff)
downloadglibc-847242451c6e53156abead29aa47a3f56cfcc928.tar.gz
glibc-847242451c6e53156abead29aa47a3f56cfcc928.tar.xz
glibc-847242451c6e53156abead29aa47a3f56cfcc928.zip
Wed May 29 00:57:37 1996 David Mosberger-Tang <davidm@azstarnet.com>
	* time/Makefile (tests): Add test-tz.

	* time/test-tz.c: New test.

	* time/clocktest.c: Rewrite to test more meaningfully.

	* sysdeps/unix/sysv/linux/syscalls.list: Add bdflush,
 	create_module, delete_module, get_kernel_syms, init_module,
 	klogctl.

	* sysdeps/unix/sysv/linux/sys/param.h (MAXSYMLINKS): Define as 5
	instead of SYMLOOP_MAX, which is nowhere to be found.

	* sysdeps/unix/sysv/linux/sys/msq_buf.h,
 	sysdeps/unix/sysv/linux/sys/sem_buf.h,
 	sysdeps/unix/sysv/linux/sys/shm_buf.h [__USE_MISC]: Add more
 	control ops and datastructures.

	* sysdeps/unix/sysv/linux/sys/io.h: New file declaring low-level
 	I/O related functions.

	* sysdeps/unix/sysv/linux/sys/kdaemon.h: New file declaring kernel
	daemon related functions/operations.

	* sysdeps/unix/sysv/linux/sys/klog.h: New file declaring kernel
	logging related functions/operations.

	* sysdeps/unix/sysv/linux/sys/module.h: New file declaring kernel
	module related functions/operations.

	* sysdeps/unix/sysv/linux/speed.c: Only do "mention this twice" hack
	for non-Alpha based Linux systems.

	* sysdeps/unix/sysv/linux/alpha/speed.c: Remove.

	* sysdeps/unix/sysv/linux/Makefile (headers): Add sys/module.h,
	sys/io.h, sys/klog.h, and sys/kdaemon.h.

	* sysdeps/unix/sysdep.h (END): Define empty END macro for
 	platforms that don't need some sort of end directive at the
	end of functions.

	* sysdeps/unix/make-syscalls.sh: Emit END($strong) at end of
 	syscall wrapper to allow correct generation of debugging
 	information.

	* sysdeps/unix/alpha/sysdep.h (END): Redefine to use .end
 	directive for both ELF and ECOFF.
	(ret): Delete macro.  It was a dangerous macro and unnecessary
 	since the Alpha assemblers recognizes "ret" as a macro themselves.

	* sysdeps/gnu/utmpbits.h (struct utmp): Move ut_tv behind
 	ut_session to guarantee long alignment.  This is important for
 	Linux/Alpha since ut_tv.tv_sec is 32 bits and time_t is 64 bits.
  	This will all get cleaned up as programs start to use ut_tv
 	instead ut_time.

	* sysdeps/alpha/divrem.h: Include <sysdep.h> instead of <*/regdef.h>.

	* sysdeps/alpha/bsd-_setjmp.S (setjmp): Renamed entry point to
	_setjmp.

	* sysdeps/alpha/_mcount.S, sysdeps/alpha/bb_init_func.S,
 	sysdeps/alpha/bsd-_setjmp.S, sysdeps/alpha/bsd-setjmp.S,
 	sysdeps/alpha/copysign.S, sysdeps/alpha/divrem.h,
 	sysdeps/alpha/fabs.S, sysdeps/alpha/ffs.S, sysdeps/alpha/htonl.S,
 	sysdeps/alpha/htons.S, sysdeps/alpha/memchr.S,
 	sysdeps/alpha/setjmp.S, sysdeps/alpha/strlen.S,
 	sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S,
 	sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S,
 	sysdeps/unix/sysv/linux/alpha/llseek.S,
 	sysdeps/unix/sysv/linux/alpha/pipe.S,
 	sysdeps/unix/sysv/linux/alpha/sigsuspend.S,
 	sysdeps/unix/sysv/linux/alpha/sysdep.S: Use END macro instead of
 	.end directive.

	* csu/initfini.c (_fini): Tell gcc that _fini is not a leaf
 	function by having it contain a dummy function call.

	* configure.in (config_machine): Don't make ELF the default for
 	Linux/Alpha just yet (use --with-elf instead).
	(.init/.fini check): Generate .text to ensure function start and
 	end are in same section.

	* sysdeps/unix/bsd/osf/alpha/brk.S,
 	sysdeps/unix/sysv/linux/alpha/brk.S (__curbrk): Store the entire
 	break value, not just the low 32 bits to accomodate large
 	memories.

Tue May 28 10:46:04 1996  Richard Henderson  <rth@tamu.edu>

	* sysdeps/unix/sysv/linux/alpha/brk.S: Rather than attempt to
	dynamically resolve _end for initializing __curbrk, support the
	brk(0) query idiom.

	* sysdeps/alpha/bb_init_func.S: Don't make `init' an external symbol.

	* sysdeps/alpha/bsd-_setjmp.S: The function is _setjmp not setjmp.

Sun May 26 22:17:38 1996  Richard Henderson  <rth@tamu.edu>

	* stdlib/lcong48_r.c, stdlib/seed48_r.c, stdlib/strtod.c,
	stdlib/strtol.c: Include <string.h> for mem* and str* fns used.

Thu May 23 02:15:56 1996  David Mosberger-Tang  <davidm@azstarnet.com>

	* sysdeps/unix/sysv/linux/Makefile (headers): Add sys/io.h,
 	sys/klog.h, and sys/kdaemon.h.

	* sysdeps/unix/sysv/linux/sys/io.h: New file.
	* sysdeps/unix/sysv/linux/sys/klog.h: Ditto.
	* sysdeps/unix/sysv/linux/sys/kdaemon.h: Ditto.

	* sysdeps/unix/alpha/sysdep.h (ret): Remove macro.  It is
 	dangerous and unnecessary since both OSF/1 as and gas define "ret"
 	as a pseudo-instruction.

Sat Jun  1 17:18:21 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>

	* time/tzset.c (__tzset): Clear tz_rules name pointers after freeing
	them.  Bug found by David Mosberger-Tang.

	* sysdeps/posix/tempname.c (__stdio_gen_tempname): Use __ptr_t instead
	of PTR.

	* extra-lib.mk (extra-objs): Use patsubst intead of $(A:=B) syntax
	to work around Make bug when A contains var ref.

Fri May 31 18:27:52 1996  Roland McGrath  <roland@delasyd.gnu.ai.mit.edu>

	* string/string.h [__USE_MISC]: Declare basename; OSF/1 puts it here.

	* sysdeps/unix/sysv/linux/syscalls.list (getpgid, setpgid): Define __
	strong names and [gs]etpgid as weak aliases.

	* math/math_private.h (GET_LDOUBLE_EXP): Add missing backslash.
Diffstat (limited to 'time')
-rw-r--r--time/Makefile2
-rw-r--r--time/clocktest.c31
-rw-r--r--time/test-tz.c57
-rw-r--r--time/tzset.c10
4 files changed, 89 insertions, 11 deletions
diff --git a/time/Makefile b/time/Makefile
index bd4d6b1c3c..dd5014104a 100644
--- a/time/Makefile
+++ b/time/Makefile
@@ -33,7 +33,7 @@ routines	:= offtime asctime clock ctime difftime gmtime	\
 		   strptime
 
 others	:= ap zdump zic
-tests	:= test_time clocktest
+tests	:= test_time clocktest test-tz
 
 tzfiles := africa antarctica asia australasia europe northamerica \
 	   southamerica etcetera factory systemv backward
diff --git a/time/clocktest.c b/time/clocktest.c
index 0a248aa181..570c194a81 100644
--- a/time/clocktest.c
+++ b/time/clocktest.c
@@ -1,16 +1,31 @@
+#include <signal.h>
 #include <stdio.h>
 #include <time.h>
+#include <unistd.h>
 
-main ()
+volatile int gotit = 0;
+
+void
+alarm_handler (int signal)
+{
+    gotit = 1;
+}
+
+
+int
+main (int argc, char ** argv)
 {
-  volatile int i;
-  double t1, t2, t;
+  clock_t start, stop;
 
-  t1 = (double) clock ();
-  for (i = 0; i < 100000; ++i) ;
-  t2 = (double) clock ();
+  signal(SIGALRM, alarm_handler);
+  alarm(1);
+  start = clock ();
+  while (!gotit);
+  stop = clock ();
 
-  t = (t2 - t1) / ((double) CLOCKS_PER_SEC);
-  printf ("%f - %f = %f\n",t2,t1,t);
+  printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",
+	  stop - start, start, stop);
+  printf ("CLOCKS_PER_SEC=%d, sysconf(_SC_CLK_TCK)=%ld\n",
+	  CLOCKS_PER_SEC, sysconf(_SC_CLK_TCK));
   return 0;
 }
diff --git a/time/test-tz.c b/time/test-tz.c
new file mode 100644
index 0000000000..47565cedec
--- /dev/null
+++ b/time/test-tz.c
@@ -0,0 +1,57 @@
+#include <stdlib.h>
+#include <time.h>
+#include <string.h>
+#include <stdio.h>
+
+struct {
+  const char *	env;
+  time_t	expected;
+} tests[] = {
+  {"TZ=MST",		832935315},
+  {"TZ=",		832910115},
+  {"TZ=:UTC",		832910115},
+  {"TZ=UTC",		832910115},
+  {"TZ=UTC0",		832910115}
+};
+
+
+int
+main(int argc, char ** argv)
+{
+  int errors = 0;
+  struct tm tm;
+  time_t t;
+  int i;
+
+  memset (&tm, 0, sizeof (tm));
+  tm.tm_isdst = 0;
+  tm.tm_year  = 96;	/* years since 1900 */
+  tm.tm_mon   = 4;
+  tm.tm_mday  = 24;
+  tm.tm_hour  =  3;
+  tm.tm_min   = 55;
+  tm.tm_sec   = 15;
+
+  for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i)
+    {
+      putenv (tests[i].env);
+      tzset ();
+      t = mktime(&tm);
+      if (t != tests[i].expected)
+	{
+	  printf ("%s: flunked test %d (expected %lu, got %lu)\n",
+		  argv[0], i, (long) tests[i].expected, (long) t);
+	  ++errors;
+	}
+    }
+  if (errors == 0)
+    {
+      puts ("No errors.");
+      exit (EXIT_SUCCESS);
+    }
+  else
+    {
+      printf ("%d errors.\n", errors);
+      exit (EXIT_FAILURE);
+    }
+}
diff --git a/time/tzset.c b/time/tzset.c
index 007997f541..5f949dce5f 100644
--- a/time/tzset.c
+++ b/time/tzset.c
@@ -85,10 +85,16 @@ DEFUN_VOID(__tzset)
 
   /* Free old storage.  */
   if (tz_rules[0].name != NULL && *tz_rules[0].name != '\0')
-    free((PTR) tz_rules[0].name);
+    {
+      free((PTR) tz_rules[0].name);
+      tz_rules[0].name = NULL;
+    }
   if (tz_rules[1].name != NULL && *tz_rules[1].name != '\0' &&
       tz_rules[1].name != tz_rules[0].name)
-    free((PTR) tz_rules[1].name);
+    {
+      free((PTR) tz_rules[1].name);
+      tz_rules[1].name = NULL;
+    }
 
   /* Examine the TZ environment variable.  */
   tz = getenv ("TZ");