Changeset 13089 in webkit for trunk/JavaScriptCore/kjs/date_object.cpp
- Timestamp:
- Mar 2, 2006, 1:12:06 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/date_object.cpp
r13015 r13089 23 23 #include "date_object.h" 24 24 25 #if HAVE _ERRNO_H25 #if HAVE(ERRNO_H) 26 26 #include <errno.h> 27 27 #endif 28 28 29 #if HAVE _SYS_PARAM_H29 #if HAVE(SYS_PARAM_H) 30 30 #include <sys/param.h> 31 31 #endif 32 32 33 #if HAVE _SYS_TIME_H33 #if HAVE(SYS_TIME_H) 34 34 #include <sys/time.h> 35 35 #endif 36 36 37 #if HAVE _SYS_TIMEB_H37 #if HAVE(SYS_TIMEB_H) 38 38 #include <sys/timeb.h> 39 39 #endif … … 52 52 #include "operations.h" 53 53 54 #if __APPLE__54 #if PLATFORM(MAC) 55 55 #include <CoreFoundation/CoreFoundation.h> 56 56 #endif 57 57 58 #if WIN3258 #if PLATFORM(WIN_OS) 59 59 #define copysign(x, y) _copysign(x, y) 60 60 #define isfinite(x) _finite(x) … … 65 65 inline int gmtoffset(const tm& t) 66 66 { 67 #if WIN3267 #if PLATFORM(WIN_OS) 68 68 // Time is supposed to be in the current timezone. 69 69 // FIXME: Use undocumented _dstbias? … … 142 142 static void millisecondsToTM(double milli, bool utc, tm *t); 143 143 144 #if __APPLE__144 #if PLATFORM(MAC) 145 145 146 146 static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateFormatterStyle defaultStyle) … … 207 207 } 208 208 209 #endif // __APPLE__209 #endif // PLATFORM(MAC) 210 210 211 211 static UString formatDate(const tm &t) … … 231 231 char buffer[100]; 232 232 if (utc) { 233 #if !WIN32 233 // FIXME: why not on windows? 234 #if !PLATFORM(WIN_OS) 234 235 ASSERT(t.tm_gmtoff == 0); 235 236 #endif … … 554 555 JSValue *result = 0; 555 556 UString s; 556 #if ! __APPLE__557 #if !PLATFORM(DARWIN) 557 558 const int bufsize=100; 558 559 char timebuffer[bufsize]; … … 610 611 return jsString(formatDateUTCVariant(t) + " " + formatTime(t, utc)); 611 612 break; 612 #if __APPLE__613 #if PLATFORM(MAC) 613 614 case ToLocaleString: 614 615 return jsString(formatLocaleDate(exec, secs, true, true, args)); … … 735 736 736 737 if (numArgs == 0) { // new Date() ECMA 15.9.3.3 737 #if !WIN32 738 #if PLATFORM(WIN_OS) 739 #if COMPILER(BORLAND) 740 struct timeb timebuffer; 741 ftime(&timebuffer); 742 #else 743 struct _timeb timebuffer; 744 _ftime(&timebuffer); 745 #endif 746 double utc = timebuffer.time * msPerSecond + timebuffer.millitm; 747 #else 738 748 struct timeval tv; 739 749 gettimeofday(&tv, 0); 740 750 double utc = floor(tv.tv_sec * msPerSecond + tv.tv_usec / 1000); 741 #else742 # if __BORLANDC__743 struct timeb timebuffer;744 ftime(&timebuffer);745 # else746 struct _timeb timebuffer;747 _ftime(&timebuffer);748 # endif749 double utc = timebuffer.time * msPerSecond + timebuffer.millitm;750 751 #endif 751 752 value = utc; … … 855 856 // obsolete time zones not listed here equivalent to "-0000". 856 857 static const struct KnownZone { 857 #if ! WIN32858 #if !PLATFORM(WIN_OS) 858 859 const 859 860 #endif … … 878 879 if (utc) { 879 880 time_t zero = 0; 880 #if !WIN32 881 #if PLATFORM(WIN_OS) 882 // FIXME: not thread safe 883 (void)localtime(&zero); 884 #if COMPILER(BORLAND) || COMPILER(CYGWIN) 885 utcOffset = - _timezone; 886 #else 887 utcOffset = - timezone; 888 #endif 889 t->tm_isdst = 0; 890 #else 881 891 tm t3; 882 892 localtime_r(&zero, &t3); 883 893 utcOffset = t3.tm_gmtoff; 884 894 t->tm_isdst = t3.tm_isdst; 885 #else886 // FIXME: not thread safe887 (void)localtime(&zero);888 # if __BORLANDC__ || __CYGWIN__889 utcOffset = - _timezone;890 # else891 utcOffset = - timezone;892 # endif893 t->tm_isdst = 0;894 895 #endif 895 896 } else {
Note:
See TracChangeset
for help on using the changeset viewer.