gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/asobj/Date.cpp


From: Markus Gothe
Subject: [Gnash-commit] gnash ChangeLog server/asobj/Date.cpp
Date: Thu, 17 May 2007 22:55:58 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Markus Gothe <nihilus>  07/05/17 22:55:58

Modified files:
        .              : ChangeLog 
        server/asobj   : Date.cpp 

Log message:
        Fixed unneeded use of ftime IFF we've got gettimeofday()

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3255&r2=1.3256
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Date.cpp?cvsroot=gnash&r1=1.44&r2=1.45

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.3255
retrieving revision 1.3256
diff -u -b -r1.3255 -r1.3256
--- ChangeLog   17 May 2007 18:47:58 -0000      1.3255
+++ ChangeLog   17 May 2007 22:55:57 -0000      1.3256
@@ -17,6 +17,7 @@
 2007-05-17 Markus Gothe <address@hidden>
 
        * configure.ac: Check if LD supports --as-needed.
+       * server/asobj/Date.cpp: Clean up and fixed uneeded ftime() use.
 
 2007-05-17 Sandro Santilli <address@hidden>
 

Index: server/asobj/Date.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Date.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/asobj/Date.cpp       18 Apr 2007 16:48:52 -0000      1.44
+++ server/asobj/Date.cpp       17 May 2007 22:55:58 -0000      1.45
@@ -107,13 +107,16 @@
 // where these things are used if available.
 
 #if !defined(HAVE_GETTIMEOFDAY) || (!defined(HAVE_TM_GMTOFF) && 
!defined(HAVE_TZSET))
-# if HAVE_FTIME
+#ifdef HAVE_FTIME
+extern "C" {
+#  include <sys/types.h>               // for ftime()
 #  include <sys/timeb.h>               // for ftime()
-# endif
+}
+#endif
 #endif
 
 #if !defined(HAVE_TM_GMTOFF)
-# if HAVE_LONG_TIMEZONE
+# ifdef HAVE_LONG_TIMEZONE
 extern long timezone;          // for tzset()/long timezone;
 # endif
 #endif
@@ -132,7 +135,7 @@
 // DST period changes the UTC time of day (it shouldn't).
 #define USE_UTCCONV 1
 
-#if USE_UTCCONV
+#ifdef USE_UTCCONV
 // forward declarations
 static void utctime(double tim, struct tm *tmp, double *msecp);
 static double mkutctime(struct tm *tmp, double msec);
@@ -148,7 +151,7 @@
 // because the C library does not provide a function to convert
 // from struct tm to datestamp in UTC.
 
-#if HAVE_LOCALTIME_R
+#ifdef HAVE_LOCALTIME_R
        // Use the library function
 #      define _localtime_r localtime_r
 
@@ -178,7 +181,7 @@
 static struct tm *
 _gmtime_r(time_t *t, struct tm *tm)
 {
-#if USE_UTCCONV
+#ifdef USE_UTCCONV
        double msec;
        utctime(*t * 1000.0, tm, &msec);
 #else
@@ -386,7 +389,7 @@
 
                gettimeofday(&tv,&tz);
                date->value = (double)tv.tv_sec * 1000.0 + tv.tv_usec / 1000.0;
-#elif HAVE_FTIME
+#elif defined(HAVE_FTIME)
                struct timeb tb;
                
                ftime (&tb);
@@ -544,7 +547,7 @@
 
 static int minutes_east_of_gmt(struct tm &tm)
 {
-#if HAVE_TM_GMTOFF
+#ifdef HAVE_TM_GMTOFF
        // tm_gmtoff is in seconds east of GMT; convert to minutes.
        return((int) (tm.tm_gmtoff / 60));
 #else
@@ -563,16 +566,7 @@
 # if defined(HAVE_TZSET) && defined(HAVE_LONG_TIMEZONE)
        tzset();
        minutes_east = -timezone/60; // timezone is seconds west of GMT
-# elif HAVE_FTIME
-       // ftime(3): "These days the contents of the timezone and dstflag
-       // fields are undefined."
-       // In practice, timezone is -120 in Italy when it should be -60.
-       struct timeb tb;
-               
-       ftime (&tb);
-       // tb.timezone is number of minutes west of GMT
-       minutes_east = -tb.timezone;
-# elif HAVE_GETTIMEOFDAY
+# elif defined(HAVE_GETTIMEOFDAY)
        // gettimeofday(3):
        // "The use of the timezone structure is obsolete; the tz argument
        // should normally be specified as NULL. The tz_dsttime field has
@@ -583,6 +577,17 @@
        struct timezone tz;
        gettimeofday(&tv,&tz);
        minutes_east = -tz.tz_minuteswest;
+
+# elif defined(HAVE_FTIME)
+       // ftime(3): "These days the contents of the timezone and dstflag
+       // fields are undefined."
+       // In practice, timezone is -120 in Italy when it should be -60.
+       struct timeb tb;
+               
+       ftime (&tb);
+       // tb.timezone is number of minutes west of GMT
+       minutes_east = -tb.timezone;
+
 # else
        minutes_east = 0;       // No idea.
 # endif
@@ -717,7 +722,7 @@
 static void
 utc_date_to_tm_msec(double value, struct tm &tm, double &msec)
 {
-#if USE_UTCCONV
+#ifdef USE_UTCCONV
        utctime(value, &tm, &msec);
 #else
        time_t t = (time_t)(value / 1000.0);
@@ -734,7 +739,7 @@
 static double
 utc_tm_msec_to_date(struct tm &tm, double &msec)
 {
-#if USE_UTCCONV
+#ifdef USE_UTCCONV
        return (mkutctime(&tm, msec));  // The better algorithm :)
 #else
        time_t t = mktime(&tm);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]