Timezone $B4X?t$,(B cygwin $B$G8+$D$+$j$^$;$s(B

e$B%k%S3+H/<T$N3’$5$s!"e(B

e$B:G?7$Ne(B HEAD e$B$Ge(B make
e$B$7$h$&$H$7$?$i<!$N$h$&$J%(%i!<$K$J$j$^$7$?!#e(B

missing/strftime.c:465: undefined reference to `_timezone’

strftime.c e$B$Oe(B 7e$B7nEv$?$j$+$iJQ99L5$7$G!"e(Bruby
e$B$N$;$$$G$O$J$$$+$H;W$$$^$9!#e(B
strftime.c e$B$r6/@)E*$K%3%s%Q%$%k$9$k$H<!$N%(%i!<$K$J$j$^$9!#e(B
./missing/strftime.c: In function `strftime’:
./missing/strftime.c:193: error: ‘timezone’ redeclared as different kind
of symbol
/usr/include/cygwin/time.h:33: error: previous declaration of ‘timezone’
was here

e$B860x$r9M$($^$9$H!":#F|5W$7$V$j$Ke(B cygwin
e$B$r99?7$7$?$3$H$,$"$j$^$9!#e(B
e$B2?$,$I$&JQ$o$C$?$+$O$h$/J,$+$j$^$;$s$,!“e(Bcygwin e$B$Ne(B CVS
e$B$rD4$Y$k$He(B
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/include/cygwin/time.h?cvsroot=src
e$BEv$?$j$K:G6a$:$$$V$s?’!9JQ99$,$”$j$^$7$?!#e(B

e$B<!$NJQ99$G%3%s%Q%$%k$O$H$j$"$($:$G$-$^$7$?$,!"$3$l$Oe(B
e$B0l;~A<CV$G!"%3%_%C%H$O$7$J$$J}$,$$$$$H;W$$$^$9!#e(B

e$B59$7$/$*4j$$$7$^$9!#e(B Martin.

Index: strftime.c

— strftime.c (revision 14192)
+++ strftime.c (working copy)
@@ -190,7 +190,7 @@
#ifndef HAVE_TM_ZONE
#ifndef HAVE_TM_NAME
#ifndef HAVE_TZNAME

  •   extern char *timezone();
    
  •   /*extern char *timezone();*/
      struct timeval tv;
      struct timezone zone;
    

#else
@@ -462,7 +462,7 @@
#else
gettimeofday(& tv, & zone);
#ifdef CYGWIN

  •                   strcpy(tbuf, timezone());
    
  •                   /* strcpy(tbuf, timezone()); */ *tbuf = 0; /* 
    

mjd: quick and dirty fix */
#else
strcpy(tbuf, timezone(zone.tz_minuteswest,
timeptr->tm_isdst > 0));

#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-# http://www.sw.it.aoyama.ac.jp mailto:[email protected]

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:32577] Re: timezone e$B4X?t$,e(B cygwin
e$B$G8+$D$+$j$^$;$se(B”
on Thu, 13 Dec 2007 17:41:21 +0900, Nobuyoshi N.
[email protected] writes:

|[email protected]!"e(Btimezonee$B$NJQ99$K$D$$$F$Oe([email protected]$N$?$a$H;W$o$l$k$Ne(B
|e$B$G!"La$5$l$k$3$H$O$J$$$G$7$g$&!#e(B

e$B$G$O!"%3%_%C%H$7$F$/[email protected]$5$$!#e(B

[email protected]$G$9!#e(B

At Tue, 11 Dec 2007 16:24:21 +0900,
Martin D. wrote in [ruby-dev:32536]:

e$B860x$r9M$($^$9$H!":#F|5W$7$V$j$Ke(B cygwin e$B$r99?7$7$?$3$H$,$"$j$^$9!#e(B
e$B2?$,$I$&JQ$o$C$?$+$O$h$/J,$+$j$^$;$s$,!“e(Bcygwin e$B$Ne(B CVS e$B$rD4$Y$k$He(B
http://cygwin.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/include/cygwin/time.h?cvsroot=src
e$BEv$?$j$K:G6a$:$$$V$s?’!9JQ99$,$”$j$^$7$?!#e(B

e$B$o$?$J$Y$5$s$K$h$k$H!":G6a$OIQHK$KJQ99$,F~$C$F$$$k$N$G!":#$O<j$re(B
e$B=P$5$J$$$[$&$,[email protected]$m$&!"[email protected]$=$&$G$9!#e(B

[email protected]!"e(Btimezonee$B$NJQ99$K$D$$$F$Oe([email protected]$N$?$a$H;W$o$l$k$Ne(B
e$B$G!"La$5$l$k$3$H$O$J$$$G$7$g$&!#e(B

Index: configure.in

— configure.in (revision 14210)
+++ configure.in (working copy)
@@ -437,5 +437,4 @@ human*) ac_cv_func_getpgrp_void=yes
beos*) ac_cv_func_link=no;;
cygwin*) rb_cv_have_daylight=no

  • ac_cv_var_tzname=no
    ac_cv_func__setjmp=no
    ac_cv_func_setitimer=no
    @@ -609,5 +608,5 @@ AC_CHECK_FUNCS(fmod killpg wait4 waitpid
    setsid telldir seekdir fchmod cosh sinh tanh log2 round
    setuid setgid daemon select_large_fdset setenv unsetenv\
  •          mktime timegm clock_gettime)
    
  •    mktime timegm clock_gettime gettimeofday)
    

AC_ARG_ENABLE(setreuid,
[ --enable-setreuid use setreuid()/setregid() according
to need even if obsolete.],
@@ -635,4 +634,28 @@ if test “$rb_cv_have_daylight” = yes; th
AC_DEFINE(HAVE_DAYLIGHT)
fi
+AC_DEFUN([RUBY_CHECK_VARTYPE], [dnl
+AC_CACHE_CHECK([for external $1], rb_cv_var_$1,

  • [rb_cv_var_$1=no
  • AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
  • $2
  • void *t;],
  • [t = &(&$1)[0];],
  • [for t in $3; do
  •  AC_TRY_COMPILE([#define _XOPEN_SOURCE 1
    
  •    $2
    
  •    extern $t $1;],
    
  •    [void *t = &(&$1)[0];],
    
  •    [rb_cv_var_$1=$t; break])
    
  • done])])
    +if test “[$rb_cv_var_]$1” != no; then
  • AC_DEFINE(HAVE_VAR_[]m4_toupper($1))
  • AC_DEFINE(TYPEOF_VAR_[]m4_toupper($1), $rb_cv_var_$1)
    +fi])
    +RUBY_CHECK_VARTYPE(timezone, [#include <time.h>], [long int])
    +RUBY_CHECK_VARTYPE(altzone, [#include <time.h>], [long int])
    +if test “$rb_cv_var_timezone” = no; then
  • AC_CHECK_FUNCS(timezone)
    +fi

AC_CACHE_CHECK(for negative time_t for gmtime(3),
rb_cv_negative_time_t,
[AC_TRY_RUN([
@@ -1214,5 +1237,5 @@ case “$target_os” in
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)

  • AC_CHECK_FUNCS(select gettimeofday)
  • AC_CHECK_FUNCS(select)
    AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
    rb_cv_missing__dtos18,
    Index: missing/strftime.c
    ===================================================================
    — missing/strftime.c (revision 14210)
    +++ missing/strftime.c (working copy)
    @@ -116,15 +116,20 @@ extern char *strchr();
    #define range(low, item, hi) max(low, min(item, hi))

+#ifdef CYGWIN
+#define DLL_IMPORT __declspec(dllimport)
+#endif
+#ifdef WIN32
+#define DLL_IMPORT __declspec(dllimport)
+#endif
#if !defined(OS2) && !defined(MSDOS) && defined(HAVE_TZNAME)
-extern char *tzname[2];
-extern int daylight;
-#ifdef SOLARIS
-extern long timezone, altzone;
-#else
-#ifdef __hpux
-extern long timezone;
-#else
-extern int timezone, altzone;
+extern DLL_IMPORT char *tzname[2];
+#ifdef HAVE_DAYLIGHT
+extern DLL_IMPORT int daylight;
+#endif
+#ifdef HAVE_VAR_TIMEZONE
+extern DLL_IMPORT TYPEOF_VAR_TIMEZONE timezone;
#endif
+#ifdef HAVE_VAR_ALTZONE
+extern DLL_IMPORT TYPEOF_VAR_ALTZONE altzone;
#endif
#endif
@@ -190,14 +195,6 @@ strftime(char *s, size_t maxsize, const
#ifndef HAVE_TM_ZONE
#ifndef HAVE_TM_NAME
-#ifndef HAVE_TZNAME

  • extern char *timezone();
    struct timeval tv;
    struct timezone zone;
    -#else
    -#ifdef __hpux
  • struct timeval tv;
  • struct timezone zone;
    -#endif
    -#endif /* HAVE_TZNAME /
    #endif /
    HAVE_TM_NAME /
    #endif /
    HAVE_TM_ZONE */
    @@ -423,19 +420,16 @@ strftime(char s, size_t maxsize, const
    off = timeptr->tm_gmtoff / 60;
    #else /
    !HAVE_TM_ZONE */
    -#if HAVE_TZNAME
  •  /*
    
  •   * Systems with tzname[] probably have timezone as
    
  •   * secs west of GMT.  Convert to mins east of GMT.
    
  •   */
    

-#ifdef __hpux
+#ifdef HAVE_GETTIMEOFDAY
gettimeofday(&tv, &zone);
off = -zone.tz_minuteswest;
#else
+#if HAVE_VAR_TIMEZONE
+#if HAVE_VAR_ALTZONE
off = -(daylight ? timezone : altzone) / 60;
+#else

  •  off = -timezone / 60;
    

+#endif
+#endif
#endif
-#else /* !HAVE_TZNAME */

  •  gettimeofday(&tv, &zone);
    
  •  off = -zone.tz_minuteswest;
    

-#endif /* !HAVE_TZNAME /
#endif /
!HAVE_TM_ZONE /
#endif /
!HAVE_TM_NAME */
@@ -461,11 +455,13 @@ strftime(char s, size_t maxsize, const
strcpy(tbuf, timeptr->tm_name);
#else
+#ifdef HAVE_TIMEZONE
gettimeofday(& tv, & zone);
-#ifdef CYGWIN
+#ifdef TIMEZONE_VOID
strcpy(tbuf, timezone());
#else
strcpy(tbuf, timezone(zone.tz_minuteswest,
timeptr->tm_isdst > 0));
-#endif
+#endif /
TIMEZONE_VOID /
+#endif /
HAVE_TIMEZONE /
#endif /
HAVE_TM_NAME /
#endif /
HAVE_TM_ZONE */
@@ -646,5 +642,5 @@ iso8601wknum(const struct tm *timeptr)
*/

  • int weeknum, jan1day, diff;
  • int weeknum, jan1day;

    /* get week number, Monday as first day of the week */

e$BCfED$5$s!"$3$s$K$A$O!#e(B

At 17:41 07/12/13, Nobuyoshi N. wrote:

e$B$o$?$J$Y$5$s$K$h$k$H!":G6a$OIQHK$KJQ99$,F~$C$F$$$k$N$G!":#$O<j$re(B
e$B=P$5$J$$$[$&$,[email protected]$m$&!"[email protected]$=$&$G$9!#e(B

[email protected]!"e(Btimezonee$B$NJQ99$K$D$$$F$Oe([email protected]$N$?$a$H;W$o$l$k$Ne(B
e$B$G!"La$5$l$k$3$H$O$J$$$G$7$g$&!#e(B

e$B$*$+$2$5$^$G$3$A$i$G$OLdBj$,D>$j$^$7$?!#$"$j$,$H$&$4$6$$$^$9!#e(B

e$B59$7$/$*4j$$$7$^$9!#e(B Martin.

#-#-# Martin J. Du"rst, Assoc. Professor, Aoyama Gakuin University
#-#-# http://www.sw.it.aoyama.ac.jp mailto:[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs