glibc/time/tst-posixtz.c

119 lines
2.9 KiB
C
Raw Normal View History

Update. 1998-10-26 11:09 Ulrich Drepper <drepper@cygnus.com> * time/Makefile (tests): Add tst-posixtz. * time/tst-posixtz.c: New file. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * elf/rtld.c (process_envvars): Accept any non-null value of LD_BIND_NOW, as mandated by the ABI. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/pread.c: Rename __syscall_pread64 to __syscall_pread. * sysdeps/unix/sysv/linux/pwrite.c: Rename __syscall_pwrite64 to __syscall_pwrite. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise. Remove duplicate entries. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Remove s_pread64 and s_pwrite64. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/llseek.c: Use INLINE_SYSCALL. * sysdeps/unix/sysv/linux/arm/syscalls.list: Rename __sys_llseek to __syscall__llseek. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Remove entry for __sys_llseek. 1998-10-26 Cristian Gafton <gafton@redhat.com> * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Add s_setfsgid and s_setfsuid. 1998-10-26 Ulrich Drepper <drepper@cygnus.com> * time/tzset.c (tz_compute): Correct last patch and describe this in a comment.
1998-10-26 11:11:28 +00:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
struct
{
time_t when;
const char *tz;
const char *result;
} tests[] =
{
{ 909312849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
"1998/10/25 21:54:09 dst=1 zone=AEDST" },
{ 924864849L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
"1999/04/23 20:54:09 dst=0 zone=AEST" },
{ 919973892L, "AEST-10AEDST-11,M10.5.0,M3.5.0",
"1999/02/26 07:18:12 dst=1 zone=AEDST" },
{ 909312849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
"1998/10/25 05:54:09 dst=0 zone=EST" },
{ 909312849L, "EST5EDT,M4.1.0/2,M10.5.0/2",
"1998/10/25 05:54:09 dst=0 zone=EST" },
{ 909312849L, "<EST5>5EDT,M4.1.0/2,M10.5.0/2",
"1998/10/25 05:54:09 dst=0 zone=EST5" },
{ 924864849L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
"1999/04/23 06:54:09 dst=1 zone=EDT" },
{ 919973892L, "EST+5EDT,M4.1.0/2,M10.5.0/2",
"1999/02/25 15:18:12 dst=0 zone=EST" },
Update. 1998-10-26 11:09 Ulrich Drepper <drepper@cygnus.com> * time/Makefile (tests): Add tst-posixtz. * time/tst-posixtz.c: New file. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * elf/rtld.c (process_envvars): Accept any non-null value of LD_BIND_NOW, as mandated by the ABI. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/pread.c: Rename __syscall_pread64 to __syscall_pread. * sysdeps/unix/sysv/linux/pwrite.c: Rename __syscall_pwrite64 to __syscall_pwrite. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise. Remove duplicate entries. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Remove s_pread64 and s_pwrite64. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/llseek.c: Use INLINE_SYSCALL. * sysdeps/unix/sysv/linux/arm/syscalls.list: Rename __sys_llseek to __syscall__llseek. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Remove entry for __sys_llseek. 1998-10-26 Cristian Gafton <gafton@redhat.com> * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Add s_setfsgid and s_setfsuid. 1998-10-26 Ulrich Drepper <drepper@cygnus.com> * time/tzset.c (tz_compute): Correct last patch and describe this in a comment.
1998-10-26 11:11:28 +00:00
};
int
main (void)
{
int result = 0;
* catgets/open_catalog.c (__open_catalog): Don't use a value type as the __builtin_expect expression, just the Boolean value. * sysdeps/generic/wordexp.c (parse_glob): int -> size_t for counter. * sysdeps/unix/sysv/linux/opensock.c (__opensock): Likewise. * resolv/res_hconf.c (arg_service_list, parse_line): Likewise. * iconvdata/tst-loading.c (main): Likewise. * catgets/tst-catgets.c (main): Likewise. * stdlib/tst-xpg-basename.c (main): Likewise. * stdlib/tst-bsearch.c (main): Likewise. * stdio-common/test-vfprintf.c (main): Likewise. * stdio-common/tst-rndseek.c (do_test): Likewise. * libio/tst_swprintf.c (main): Likewise. * libio/tst-fgetws.c (main): Likewise. * wcsmbs/tst-mbrtowc.c (check_ascii): Likewise. * time/tst-posixtz.c (main): Likewise. * time/tst-strptime.c (test_tm): Likewise. * time/tst-strptime.c (main): Likewise. * time/tst-getdate.c (main): Likewise. * posix/tst-mmap.c (main): Likewise. * posix/tst-getaddrinfo.c (do_test): Likewise. * io/tst-getcwd.c (do_test): Likewise. * resolv/tst-aton.c (main): Likewise. * inet/tst-network.c (main): Likewise. * libio/tst-fgetws.c (main): Likewise. * sysdeps/posix/sprofil.c (add_region): int -> unsigned int for I. * sysdeps/unix/sysv/linux/ptsname.c (__ptsname_r): int -> unsigned int for PTYNO. * stdlib/msort.c (qsort): Add a cast to silence warning. * stdio-common/vfprintf.c (process_string_arg): Likewise. * libio/oldfileops.c (_IO_old_do_write): Likewise. * sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Likewise. * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise. * sysdeps/unix/sysv/linux/gethostid.c (gethostid): Likewise. * argp/argp-fmtstream.c (__argp_fmtstream_printf): Likewise. * nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise. * sysdeps/unix/grantpt.c (grantpt): Likewise. * libio/tst-widetext.c (main): Likewise. * libio/tst-mmap2-eofsync.c (do_test): Likewise. * rt/tst-aio.c (test_file): Likewise. * rt/tst-aio64.c (test_file): Likewise. * resolv/tst-aton.c (main): Likewise. * catgets/catgetsinfo.h (CATGETS_MAGIC): Use U suffix on the constant. * ctype/ctype.c (__ctype_tolower, __ctype_toupper): Cast to int32_t instead of uint32_t in these macros.
2002-09-24 04:24:25 +00:00
size_t cnt;
Update. 1998-10-26 11:09 Ulrich Drepper <drepper@cygnus.com> * time/Makefile (tests): Add tst-posixtz. * time/tst-posixtz.c: New file. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * elf/rtld.c (process_envvars): Accept any non-null value of LD_BIND_NOW, as mandated by the ABI. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/pread.c: Rename __syscall_pread64 to __syscall_pread. * sysdeps/unix/sysv/linux/pwrite.c: Rename __syscall_pwrite64 to __syscall_pwrite. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise. Remove duplicate entries. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Remove s_pread64 and s_pwrite64. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/llseek.c: Use INLINE_SYSCALL. * sysdeps/unix/sysv/linux/arm/syscalls.list: Rename __sys_llseek to __syscall__llseek. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Remove entry for __sys_llseek. 1998-10-26 Cristian Gafton <gafton@redhat.com> * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Add s_setfsgid and s_setfsuid. 1998-10-26 Ulrich Drepper <drepper@cygnus.com> * time/tzset.c (tz_compute): Correct last patch and describe this in a comment.
1998-10-26 11:11:28 +00:00
for (cnt = 0; cnt < sizeof (tests) / sizeof (tests[0]); ++cnt)
{
char buf[100];
struct tm *tmp;
printf ("TZ = \"%s\", time = %ld => ", tests[cnt].tz, tests[cnt].when);
fflush (stdout);
setenv ("TZ", tests[cnt].tz, 1);
tmp = localtime (&tests[cnt].when);
snprintf (buf, sizeof (buf),
"%04d/%02d/%02d %02d:%02d:%02d dst=%d zone=%s",
tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
tmp->tm_hour, tmp->tm_min, tmp->tm_sec, tmp->tm_isdst,
tzname[tmp->tm_isdst ? 1 : 0]);
fputs (buf, stdout);
if (strcmp (buf, tests[cnt].result) == 0)
puts (", OK");
else
{
result = 1;
puts (", FAIL");
}
}
setenv ("TZ", "Universal", 1);
localtime (&tests[0].when);
printf ("TZ = \"Universal\" daylight %d tzname = { \"%s\", \"%s\" }",
daylight, tzname[0], tzname[1]);
if (! daylight)
puts (", OK");
else
{
result = 1;
puts (", FAIL");
}
setenv ("TZ", "AEST-10AEDST-11,M10.5.0,M3.5.0", 1);
tzset ();
printf ("TZ = \"AEST-10AEDST-11,M10.5.0,M3.5.0\" daylight %d"
" tzname = { \"%s\", \"%s\" }", daylight, tzname[0], tzname[1]);
if (daylight
&& strcmp (tzname[0], "AEST") == 0 && strcmp (tzname[1], "AEDST") == 0)
puts (", OK");
else
{
result = 1;
puts (", FAIL");
}
setenv ("TZ", "<AB1>-10<AB2>-11,M10.5.0,M3.5.0", 1);
tzset ();
printf ("TZ = \"<AB1>-10<AB2>-11,M10.5.0,M3.5.0\" daylight %d"
" tzname = { \"%s\", \"%s\" }", daylight, tzname[0], tzname[1]);
if (daylight
&& strcmp (tzname[0], "AB1") == 0 && strcmp (tzname[1], "AB2") == 0)
puts (", OK");
else
{
result = 1;
puts (", FAIL");
}
setenv ("TZ", "<BB1>-10", 1);
tzset ();
printf ("TZ = \"<BB1>-10\" daylight %d"
" tzname = { \"%s\", \"%s\" }", daylight, tzname[0], tzname[1]);
if (daylight == 0
&& strcmp (tzname[0], "BB1") == 0 && strcmp (tzname[1], "BB1") == 0)
puts (", OK");
else
{
result = 1;
puts (", FAIL");
}
Update. 1998-10-26 11:09 Ulrich Drepper <drepper@cygnus.com> * time/Makefile (tests): Add tst-posixtz. * time/tst-posixtz.c: New file. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * elf/rtld.c (process_envvars): Accept any non-null value of LD_BIND_NOW, as mandated by the ABI. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/pread.c: Rename __syscall_pread64 to __syscall_pread. * sysdeps/unix/sysv/linux/pwrite.c: Rename __syscall_pwrite64 to __syscall_pwrite. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/arm/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/powerpc/syscalls.list: Likewise. Remove duplicate entries. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Remove s_pread64 and s_pwrite64. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Likewise. 1998-10-24 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> * sysdeps/unix/sysv/linux/llseek.c: Use INLINE_SYSCALL. * sysdeps/unix/sysv/linux/arm/syscalls.list: Rename __sys_llseek to __syscall__llseek. * sysdeps/unix/sysv/linux/mips/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Likewise. * sysdeps/unix/sysv/linux/i386/syscalls.list: Remove entry for __sys_llseek. 1998-10-26 Cristian Gafton <gafton@redhat.com> * sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Add s_setfsgid and s_setfsuid. 1998-10-26 Ulrich Drepper <drepper@cygnus.com> * time/tzset.c (tz_compute): Correct last patch and describe this in a comment.
1998-10-26 11:11:28 +00:00
return result;
}