Page MenuHomeFreeBSD

D44281.id135553.diff
No OneTemporary

D44281.id135553.diff

diff --git a/contrib/tzcode/tzconfig.h b/contrib/tzcode/tzconfig.h
--- a/contrib/tzcode/tzconfig.h
+++ b/contrib/tzcode/tzconfig.h
@@ -13,7 +13,7 @@
#define NETBSD_INSPIRED 0
#define STD_INSPIRED 1
#define HAVE_TZNAME 2
-#define USG_COMPAT 0
+#define USG_COMPAT 2
#define ALTZONE 0
#endif /* !TZCONFIG_H_INCLUDED */
diff --git a/include/time.h b/include/time.h
--- a/include/time.h
+++ b/include/time.h
@@ -162,10 +162,11 @@
#if __XSI_VISIBLE
char *strptime(const char * __restrict, const char * __restrict,
struct tm * __restrict);
+extern long timezone;
+extern int daylight;
#endif
#if __BSD_VISIBLE
-char *timezone(int, int); /* XXX XSI conflict */
time_t timelocal(struct tm * const);
time_t timegm(struct tm * const);
int timer_oshandle_np(timer_t timerid);
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -307,7 +307,6 @@
times.3 \
timespec_get.3 \
timespec_getres.3 \
- timezone.3 \
ttyname.3 \
tzset.3 \
ualarm.3 \
diff --git a/lib/libc/gen/Symbol.map b/lib/libc/gen/Symbol.map
--- a/lib/libc/gen/Symbol.map
+++ b/lib/libc/gen/Symbol.map
@@ -261,7 +261,6 @@
setlogmask;
ttyname_r;
ttyname;
- timezone;
times;
time;
telldir;
@@ -458,6 +457,8 @@
aio_read2;
aio_write2;
execvpe;
+ timezone;
+ daylight;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/gen/timezone.3 b/lib/libc/gen/timezone.3
deleted file mode 100644
--- a/lib/libc/gen/timezone.3
+++ /dev/null
@@ -1,66 +0,0 @@
-.\" Copyright (c) 1991, 1993
-.\" The Regents of the University of California. All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\" 3. Neither the name of the University nor the names of its contributors
-.\" may be used to endorse or promote products derived from this software
-.\" without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.Dd April 19, 1994
-.Dt TIMEZONE 3
-.Os
-.Sh NAME
-.Nm timezone
-.Nd return the timezone abbreviation
-.Sh LIBRARY
-.Lb libc
-.Sh SYNOPSIS
-.Ft char *
-.Fn timezone "int zone" "int dst"
-.Sh DESCRIPTION
-.Bf Sy
-This interface is for compatibility only; it is impossible to reliably
-map timezone's arguments to a time zone abbreviation.
-See
-.Xr ctime 3 .
-.Ef
-.Pp
-The
-.Fn timezone
-function returns a pointer to a time zone abbreviation for the specified
-.Fa zone
-and
-.Fa dst
-values.
-The
-.Fa zone
-argument
-is the number of minutes west of GMT and
-.Fa dst
-is non-zero if daylight savings time is in effect.
-.Sh SEE ALSO
-.Xr ctime 3
-.Sh HISTORY
-A
-.Fn timezone
-function appeared in
-.At v7 .
diff --git a/lib/libc/gen/timezone.c b/lib/libc/gen/timezone.c
--- a/lib/libc/gen/timezone.c
+++ b/lib/libc/gen/timezone.c
@@ -36,7 +36,7 @@
#include <string.h>
#define TZ_MAX_CHARS 255
-char *_tztab(int, int);
+static char *_tztab(int, int);
/*
* timezone --
@@ -49,7 +49,7 @@
static char czone[TZ_MAX_CHARS]; /* space for zone name */
char *
-timezone(int zone, int dst)
+__timezone_compat(int zone, int dst)
{
char *beg,
*end;
@@ -68,6 +68,7 @@
}
return(_tztab(zone,dst)); /* default: table or created zone */
}
+__sym_compat(timezone, __timezone_compat, FBSD_1.0);
static struct zone {
int offset;
@@ -99,7 +100,7 @@
* aren't in place in /etc. DO NOT USE THIS ROUTINE OUTSIDE OF THE
* STANDARD LIBRARY.
*/
-char *
+static char *
_tztab(int zone, int dst)
{
struct zone *zp;
diff --git a/lib/libc/gen/tzset.3 b/lib/libc/gen/tzset.3
--- a/lib/libc/gen/tzset.3
+++ b/lib/libc/gen/tzset.3
@@ -28,16 +28,22 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd March 6, 2023
+.Dd December 25, 2023
.Dt TZSET 3
.Os
.Sh NAME
+.Nm daylight ,
+.Nm timezone ,
+.Nm tzname ,
.Nm tzset
.Nd initialize time conversion information
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In time.h
+.Vt extern int daylight ;
+.Vt extern long timezone ;
+.Vt extern char *tzname[2] ;
.Ft void
.Fn tzset void
.Sh DESCRIPTION
@@ -93,6 +99,21 @@
file and cannot be interpreted as a direct specification,
.Tn UTC
is used.
+.Pp
+After the first call to
+.Nm tzset ,
+the
+.Vt timezone
+variable is set to the difference, in seconds, between Coordinated Universal
+Time (UTC) and the local time.
+The
+.Vt daylight
+variable is set to 0 if the local timezone is observing standard time.
+It is set to 1 if the local timezone ever observes an alternate time, such as summer time.
+The first element of the
+.Vt tzname
+array is the timezone name of standard time, while the second element is the
+name of the altnerative time zone.
.Sh SPECIFICATION FORMAT
When
.Ev TZ

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 18, 8:23 AM (18 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27707067
Default Alt Text
D44281.id135553.diff (5 KB)

Event Timeline