[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:58:28 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 7ace12a83b44de4e594c9f3fa6dcad8a359e2b2b
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Nov 9 07:46:17 2002 +0000
* kjs/date_object.cpp:
(ctimeUsingCF): Added.
(timeUsingCF): Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2612 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index b0c746c..0b2a114 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,9 @@
+2002-11-08 Darin Adler <darin at apple.com>
+
+ * kjs/date_object.cpp:
+ (ctimeUsingCF): Added.
+ (timeUsingCF): Added.
+
2002-11-07 Darin Adler <darin at apple.com>
* kjs/date_object.cpp: (mktimeUsingCF): Fix storage leak.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index b0c746c..0b2a114 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,9 @@
+2002-11-08 Darin Adler <darin at apple.com>
+
+ * kjs/date_object.cpp:
+ (ctimeUsingCF): Added.
+ (timeUsingCF): Added.
+
2002-11-07 Darin Adler <darin at apple.com>
* kjs/date_object.cpp: (mktimeUsingCF): Fix storage leak.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index b0c746c..0b2a114 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,9 @@
+2002-11-08 Darin Adler <darin at apple.com>
+
+ * kjs/date_object.cpp:
+ (ctimeUsingCF): Added.
+ (timeUsingCF): Added.
+
2002-11-07 Darin Adler <darin at apple.com>
* kjs/date_object.cpp: (mktimeUsingCF): Fix storage leak.
diff --git a/JavaScriptCore/kjs/date_object.cpp b/JavaScriptCore/kjs/date_object.cpp
index 2aaae31..9de1427 100644
--- a/JavaScriptCore/kjs/date_object.cpp
+++ b/JavaScriptCore/kjs/date_object.cpp
@@ -64,22 +64,23 @@
#include <CoreFoundation/CoreFoundation.h>
+#define ctime(x) ctimeUsingCF(x)
#define gmtime(x) gmtimeUsingCF(x)
#define localtime(x) localtimeUsingCF(x)
#define mktime(x) mktimeUsingCF(x)
+//#define strftime(a, b, c, d) notAllowedToCall()
-struct tm *tmUsingCF(time_t tv, CFTimeZoneRef timeZone)
+struct tm *tmUsingCF(time_t clock, CFTimeZoneRef timeZone)
{
static struct tm result;
static char timeZoneCString[128];
- CFAbsoluteTime absoluteTime = tv - kCFAbsoluteTimeIntervalSince1970;
-
+ CFAbsoluteTime absoluteTime = clock - kCFAbsoluteTimeIntervalSince1970;
CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(absoluteTime, timeZone);
-
+
CFStringRef abbreviation = CFTimeZoneCopyAbbreviation(timeZone, absoluteTime);
-
CFStringGetCString(abbreviation, timeZoneCString, sizeof(timeZoneCString), kCFStringEncodingASCII);
+ CFRelease(abbreviation);
result.tm_sec = (int)date.second;
result.tm_min = date.minute;
@@ -93,21 +94,40 @@ struct tm *tmUsingCF(time_t tv, CFTimeZoneRef timeZone)
result.tm_gmtoff = (int)CFTimeZoneGetSecondsFromGMT(timeZone, absoluteTime);
result.tm_zone = timeZoneCString;
- CFRelease(abbreviation);
-
return &result;
}
-struct tm *gmtimeUsingCF(const time_t *tv)
+char *ctimeUsingCF(const time_t *clock)
+{
+ static char result[26];
+
+ CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
+
+ CFAbsoluteTime absoluteTime = *clock - kCFAbsoluteTimeIntervalSince1970;
+ CFGregorianDate date = CFAbsoluteTimeGetGregorianDate(absoluteTime, timeZone);
+
+ const char * const weekdayName[7] = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
+ const char * const monthName[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
+
+ sprintf(result, "%s %s %02d %02d:%02d:%02.f %04ld\n",
+ weekdayName[CFAbsoluteTimeGetDayOfWeek(absoluteTime, timeZone) - 1],
+ monthName[date.month - 1], date.day, date.hour, date.minute, date.second, date.year);
+
+ CFRelease(timeZone);
+
+ return result;
+}
+
+struct tm *gmtimeUsingCF(const time_t *clock)
{
static CFTimeZoneRef timeZoneUTC = CFTimeZoneCreateWithName(NULL, CFSTR("UTC"), TRUE);
- return tmUsingCF(*tv, timeZoneUTC);
+ return tmUsingCF(*clock, timeZoneUTC);
}
-struct tm *localtimeUsingCF(const time_t *tv)
+struct tm *localtimeUsingCF(const time_t *clock)
{
CFTimeZoneRef timeZone = CFTimeZoneCopyDefault();
- struct tm *result = tmUsingCF(*tv, timeZone);
+ struct tm *result = tmUsingCF(*clock, timeZone);
CFRelease(timeZone);
return result;
}
@@ -131,6 +151,15 @@ time_t mktimeUsingCF(struct tm *tm)
return (time_t)(absoluteTime + kCFAbsoluteTimeIntervalSince1970);
}
+time_t timeUsingCF(time_t *clock)
+{
+ time_t result = (time_t)(CFAbsoluteTimeGetCurrent() + kCFAbsoluteTimeIntervalSince1970);
+ if (clock) {
+ *clock = result;
+ }
+ return result;
+}
+
#endif // APPLE_CHANGES
using namespace KJS;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list