[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash/server/asobj Date.cpp
From: |
Martin Guy |
Subject: |
[Gnash-commit] gnash/server/asobj Date.cpp |
Date: |
Tue, 06 Feb 2007 18:03:38 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Martin Guy <martinwguy> 07/02/06 18:03:38
Modified files:
server/asobj : Date.cpp
Log message:
Fix bug in setUTCHours(),
make utc/localtime specification compulsory in inner workings
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/Date.cpp?cvsroot=gnash&r1=1.18&r2=1.19
Patches:
Index: Date.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/Date.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- Date.cpp 3 Feb 2007 21:30:05 -0000 1.18
+++ Date.cpp 6 Feb 2007 18:03:38 -0000 1.19
@@ -532,7 +532,7 @@
{
time_t t = mktime(&tm);
- // Recostruct the time value and put the milliseconds back in.
+ // Reconstruct the time value and put the milliseconds back in.
// If mktime fails to reconstruct the date, change nothing.
if (t == (time_t)(-1)) {
log_error("Failed to set a date.\n");
@@ -550,9 +550,8 @@
static void
utc_date_to_tm_msec(date_as_object* &date, struct tm &tm, double &msec)
{
- msec = std::fmod(date->value, 1000.0);
time_t t = (time_t)(date->value / 1000.0);
-
+ msec = std::fmod(date->value, 1000.0);
_gmtime_r(&t, &tm);
}
@@ -569,8 +568,8 @@
if (t == (time_t)(-1)) {
log_error("utc_tm_msec_to_date failed to convert back to Date");
} else {
- // Restore the UTC time-of-day
- t = (t % 86400) + tm.tm_sec + 60 * (tm.tm_min + 60 * tm.tm_hour);
+ // Knock out the H:M:S part of t and replace with UTC time-of-day
+ t = t - (t % 86400) + tm.tm_sec + 60 * (tm.tm_min + 60 *
tm.tm_hour);
}
date->value = t * 1000.0 + msec;
@@ -621,7 +620,7 @@
/// If changing the year or month results in an impossible date, it is
/// normalised: 29 Feb becomes 1 Mar, 31 April becomes 1 May etc.
-static void _date_setfullyear(const fn_call& fn, bool utc=false) {
+static void _date_setfullyear(const fn_call& fn, bool utc) {
date_as_object* date = ensure_date_object(fn.this_ptr);
// assert(fn.nargs >= 1 && fn.nargs <= 3);
@@ -881,7 +880,7 @@
// Bindings for localtime versions
#define local_proto(item) \
static void date_set##item(const fn_call& fn) { \
- _date_set##item(fn); \
+ _date_set##item(fn, false); \
}
local_proto(fullyear)
local_proto(month)
@@ -889,6 +888,7 @@
local_proto(hours)
local_proto(minutes)
local_proto(seconds)
+#undef local_proto
// The same things for UTC.
#define utc_proto(item) \
@@ -901,6 +901,7 @@
utc_proto(hours)
utc_proto(minutes)
utc_proto(seconds)
+#undef utc_proto
/// \brief Date.toString()
@@ -947,6 +948,7 @@
// tm_isdst is negative: cannot get TZ info.
// Convert and print in UTC instead.
_gmtime_r(&t, &tm);
+ tzhours = tzminutes = 0;
}
// If timezone is negative, both hours and minutes will be negative
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/01
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/02
- [Gnash-commit] gnash/server/asobj Date.cpp,
Martin Guy <=
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/07
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/07
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/11
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/17
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/27
- [Gnash-commit] gnash/server/asobj Date.cpp, Markus Gothe, 2007/02/27
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/28
- [Gnash-commit] gnash/server/asobj Date.cpp, Martin Guy, 2007/02/28