Finally deprecate the old timezone() interface in favor of an XSH5

timezone/daytime pair; as proposed by J.T. in September, 1996.
Fixes PR standards/11807 by Nick Hudson.
This commit is contained in:
kleink 2001-03-31 18:29:20 +00:00
parent 4ce4608f9f
commit a495a577a0
7 changed files with 53 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: time.h,v 1.26 2001/03/29 19:06:39 kleink Exp $ */
/* $NetBSD: time.h,v 1.27 2001/03/31 18:29:20 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -113,6 +113,10 @@ void tzset __P((void));
*/
#if (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)) || \
(_XOPEN_SOURCE - 0) >= 4
extern int daylight;
#ifndef __LIBC12_SOURCE__
extern long int timezone __RENAME(__timezone13);
#endif
char *strptime __P((const char * __restrict, const char * __restrict,
struct tm * __restrict));
#endif
@ -149,7 +153,9 @@ time_t posix2time __P((time_t));
time_t timegm __P((struct tm *const));
time_t timeoff __P((struct tm *const, const long));
time_t timelocal __P((struct tm *const));
#ifdef __LIBC12_SOURCE__
char *timezone __P((int, int));
#endif
void tzsetwall __P((void));
struct tm *offtime __P((const time_t *const, const long));
#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */

View File

@ -1,4 +1,4 @@
.\" $NetBSD: timezone.3,v 1.10 1998/08/02 03:20:41 jeremy Exp $
.\" $NetBSD: timezone.3,v 1.11 2001/03/31 18:29:21 kleink Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -47,11 +47,15 @@
.Sh DESCRIPTION
.Bf -symbolic
.\" This interface is available from the compatibility library, libcompat;
This interface is available for compatibility;
This interface is available for compatibility only and will disappear in a
future software release;
it is impossible to reliably map timezone's arguments to a time zone
abbreviation.
See
.Xr ctime 3 .
.Xr ctime 3 ;
see
.Xr tzset 3
for the new definition of this interface.
.Ef
.Pp
The
@ -66,7 +70,8 @@ is the number of minutes west of GMT and
.Ar dst
is non-zero if daylight savings time is in effect.
.Sh SEE ALSO
.Xr ctime 3
.Xr ctime 3 ,
.Xr tzset 3
.Sh HISTORY
A
.Fn timezone

View File

@ -1,4 +1,4 @@
/* $NetBSD: timezone.c,v 1.14 2000/01/23 07:37:47 mycroft Exp $ */
/* $NetBSD: timezone.c,v 1.15 2001/03/31 18:29:21 kleink Exp $ */
/*
* Copyright (c) 1987, 1993
@ -38,10 +38,12 @@
#if 0
static char sccsid[] = "@(#)timezone.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: timezone.c,v 1.14 2000/01/23 07:37:47 mycroft Exp $");
__RCSID("$NetBSD: timezone.c,v 1.15 2001/03/31 18:29:21 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
#define __LIBC12_SOURCE__
#include "namespace.h"
#include <sys/types.h>
#include <sys/time.h>
@ -50,12 +52,6 @@ __RCSID("$NetBSD: timezone.c,v 1.14 2000/01/23 07:37:47 mycroft Exp $");
#include <string.h>
#include <tzfile.h>
#if 0
#ifdef __weak_alias
__weak_alias(timezone,_timezone)
#endif
#endif
/*
* timezone --
* The arguments are the number of minutes of time you are westward

View File

@ -1,10 +1,11 @@
# $NetBSD: Makefile.inc,v 1.7 1999/05/04 15:34:50 kleink Exp $
# $NetBSD: Makefile.inc,v 1.8 2001/03/31 18:29:21 kleink Exp $
.PATH: ${.CURDIR}/time
SRCS+= asctime.c difftime.c localtime.c strftime.c strptime.c
SRCS+= _daylight.c \
asctime.c difftime.c localtime.c strftime.c strptime.c
MAN+= ctime.3 time2posix.3 tzfile.5 tzset.3 strftime.3 strptime.3
CFLAGS+=-DALL_STATE
CFLAGS+=-DALL_STATE -DUSG_COMPAT
MLINKS+=ctime.3 ctime_r.3 \
ctime.3 asctime.3 \

13
lib/libc/time/_daylight.c Normal file
View File

@ -0,0 +1,13 @@
/* $NetBSD: _daylight.c,v 1.1 2001/03/31 18:29:21 kleink Exp $ */
/*
* Written by Klaus Klein, December 27, 2000.
* Public domain.
*/
#include <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(_daylight, daylight)
#endif
/* LINTED empty translation unit */

View File

@ -1,4 +1,4 @@
/* $NetBSD: localtime.c,v 1.24 2000/09/13 22:32:28 msaitoh Exp $ */
/* $NetBSD: localtime.c,v 1.25 2001/03/31 18:29:21 kleink Exp $ */
/*
** This file is in the public domain, so clarified as of
@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 7.70";
#else
__RCSID("$NetBSD: localtime.c,v 1.24 2000/09/13 22:32:28 msaitoh Exp $");
__RCSID("$NetBSD: localtime.c,v 1.25 2001/03/31 18:29:21 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -30,6 +30,7 @@ __RCSID("$NetBSD: localtime.c,v 1.24 2000/09/13 22:32:28 msaitoh Exp $");
#ifdef __weak_alias
__weak_alias(ctime_r,_ctime_r)
__weak_alias(daylight,_daylight)
__weak_alias(gmtime_r,_gmtime_r)
__weak_alias(localtime_r,_localtime_r)
__weak_alias(offtime,_offtime)

View File

@ -1,4 +1,4 @@
.\" $NetBSD: tzset.3,v 1.12 2001/03/29 20:56:30 kleink Exp $
.\" $NetBSD: tzset.3,v 1.13 2001/03/31 18:29:21 kleink Exp $
.TH TZSET 3
.SH NAME
tzset \- initialize time conversion information
@ -8,6 +8,8 @@ Standard C Library (libc, -lc)
.nf
.B void tzset(void);
.PP
.B extern long int timezone;
.B extern int daylight;
.fi
.SH DESCRIPTION
.I Tzset
@ -215,6 +217,16 @@ environment variable does not specify a
.IR tzfile (5)-format
and cannot be interpreted as a direct specification,
UTC is used.
.PP
.I Tzset
sets the external variable
.I timezone
to the difference, in seconds, between Coordinated Universal Time (UTC)
and local standard time.
The external variable
.I daylight
is set to 0 if Daylight Savings Time conversions should never be applied
for the time zone in use; otherwise non-zero.
.SH FILES
.ta \w'/usr/share/zoneinfo/posixrules\0\0'u
/etc/localtime local time zone file