forked from pool/timezone
6b60f7e04a
1 OBS-URL: https://build.opensuse.org/request/show/379068 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/timezone?expand=0&rev=102
97 lines
2.2 KiB
Diff
97 lines
2.2 KiB
Diff
commit 301f794f33d145b08fbf7f5247c8663d404fabb5
|
||
Author: Paul Eggert <eggert@cs.ucla.edu>
|
||
Date: Fri Feb 26 08:58:45 2016 -0800
|
||
|
||
Fix tzname redefinition in MS-Windows
|
||
|
||
Problem reported by Ian Abbott in:
|
||
http://mm.icann.org/pipermail/tz/2016-February/023289.html
|
||
* localtime.c (tzname): Don’t define if HAVE_POSIX_DECLS,
|
||
as causes the Microsoft compiler to complain that tzname
|
||
is redeclared without dllimport.
|
||
* localtime.c, private.h (altzone): Do define even if
|
||
HAVE_POSIX_DECLS, since this is not a POSIX-specified variable.
|
||
|
||
diff --git a/localtime.c b/localtime.c
|
||
index e3bc763..276ce34 100644
|
||
--- a/localtime.c
|
||
+++ b/localtime.c
|
||
@@ -178,11 +178,6 @@ static struct state gmtmem;
|
||
static char lcl_TZname[TZ_STRLEN_MAX + 1];
|
||
static int lcl_is_set;
|
||
|
||
-char * tzname[2] = {
|
||
- (char *) wildabbr,
|
||
- (char *) wildabbr
|
||
-};
|
||
-
|
||
/*
|
||
** Section 4.12.3 of X3.159-1989 requires that
|
||
** Except for the strftime function, these functions [asctime,
|
||
@@ -193,10 +188,16 @@ char * tzname[2] = {
|
||
|
||
static struct tm tm;
|
||
|
||
-#ifdef USG_COMPAT
|
||
+#if !HAVE_POSIX_DECLS
|
||
+char * tzname[2] = {
|
||
+ (char *) wildabbr,
|
||
+ (char *) wildabbr
|
||
+};
|
||
+# ifdef USG_COMPAT
|
||
long timezone;
|
||
int daylight;
|
||
-#endif /* defined USG_COMPAT */
|
||
+# endif
|
||
+#endif
|
||
|
||
#ifdef ALTZONE
|
||
long altzone;
|
||
diff --git a/private.h b/private.h
|
||
index 6080e71..e23764d 100644
|
||
--- a/private.h
|
||
+++ b/private.h
|
||
@@ -386,8 +386,6 @@ time_t time(time_t *);
|
||
void tzset(void);
|
||
#endif
|
||
|
||
-#if !HAVE_POSIX_DECLS
|
||
-
|
||
/*
|
||
** Some time.h implementations don't declare asctime_r.
|
||
** Others might define it as a macro.
|
||
@@ -395,24 +393,24 @@ void tzset(void);
|
||
** Similarly for timezone, daylight, and altzone.
|
||
*/
|
||
|
||
-#ifndef asctime_r
|
||
+#if !HAVE_POSIX_DECLS
|
||
+# ifndef asctime_r
|
||
extern char * asctime_r(struct tm const *restrict, char *restrict);
|
||
-#endif
|
||
-
|
||
-#ifdef USG_COMPAT
|
||
-# ifndef timezone
|
||
-extern long timezone;
|
||
# endif
|
||
-# ifndef daylight
|
||
+# ifdef USG_COMPAT
|
||
+# ifndef timezone
|
||
+extern long timezone;
|
||
+# endif
|
||
+# ifndef daylight
|
||
extern int daylight;
|
||
+# endif
|
||
# endif
|
||
#endif
|
||
+
|
||
#if defined ALTZONE && !defined altzone
|
||
extern long altzone;
|
||
#endif
|
||
|
||
-#endif
|
||
-
|
||
/*
|
||
** The STD_INSPIRED functions are similar, but most also need
|
||
** declarations if time_tz is defined.
|