summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bignum.c2
-rw-r--r--time.c52
-rw-r--r--version.h4
4 files changed, 40 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index 0a69af5fdc..0409bc408d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jun 23 22:34:51 2000 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * bignum.c (rb_big_lshift): reorder xds assignment to avoid
+ reusing `x' as `len' by VC++ 6.0 SP3 compiler with -Ox switch.
+
Fri Jun 23 17:36:03 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
* stable version 1.4.5 released.
diff --git a/bignum.c b/bignum.c
index 127f32baba..dca0edc14b 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1199,13 +1199,13 @@ rb_big_lshift(x, y)
long len, i;
if (shift < 0) return rb_big_rshift(x, INT2FIX(-shift));
- xds = BDIGITS(x);
len = RBIGNUM(x)->len;
z = bignew(len+s1+1, RBIGNUM(x)->sign);
zds = BDIGITS(z);
for (i=0; i<s1; i++) {
*zds++ = 0;
}
+ xds = BDIGITS(x);
for (i=0; i<len; i++) {
num = num | *xds++<<s2;
*zds++ = BIGLO(num);
diff --git a/time.c b/time.c
index e734155fc6..1b2cb73c56 100644
--- a/time.c
+++ b/time.c
@@ -301,17 +301,27 @@ make_time_t(tptr, utc_or_local)
if (!utc_or_local) { /* localtime zone adjust */
#if defined(HAVE_TM_ZONE)
tm = localtime(&guess);
+ if (!tm) goto error;
guess -= tm->tm_gmtoff;
+ tm = localtime(&guess);
+ if (!tm) goto error;
+ if (tm->tm_hour != tptr->tm_hour) {
+ guess += (tptr->tm_hour - tm->tm_hour)*3600;
+ }
#else
struct tm gt, lt;
long tzsec;
t = 0;
- gt = *gmtime(&guess);
- lt = *localtime(&guess);
+ tm = gmtime(&guess);
+ if (!tm) goto error;
+ gt = *tm;
+ tm = localtime(&guess);
+ if (!tm) goto error;
+ lt = *tm;
tzsec = (gt.tm_min-lt.tm_min)*60 + (gt.tm_hour-lt.tm_hour)*3600;
- if(lt.tm_year > gt.tm_year) {
+ if (lt.tm_year > gt.tm_year) {
tzsec -= 24*3600;
}
else if(gt.tm_year > lt.tm_year) {
@@ -320,16 +330,14 @@ make_time_t(tptr, utc_or_local)
else {
tzsec += (gt.tm_yday - lt.tm_yday)*24*3600;
}
-
- if (lt.tm_isdst) tzsec += 3600;
-
+ if (lt.tm_isdst) guess += 3600;
guess += tzsec;
if (guess < 0) {
goto out_of_range;
}
tm = localtime(&guess);
if (!tm) goto error;
- if (tm->tm_hour != tptr->tm_hour) {
+ if (lt.tm_isdst != tm->tm_isdst) {
guess -= 3600;
}
#endif
@@ -362,7 +370,7 @@ time_gm_or_local(argc, argv, gm_or_local, klass)
fn = (gm_or_local) ? gmtime : localtime;
time_arg(argc, argv, &tm);
- time = time_new_internal(klass, make_time_t(&tm, fn), 0);
+ time = time_new_internal(klass, make_time_t(&tm, gm_or_local), 0);
if (gm_or_local) return time_gmtime(time);
return time_localtime(time);
}
@@ -434,14 +442,12 @@ time_cmp(time1, time2)
{
double t;
- if (tobj1->tv.tv_sec == (time_t)RFLOAT(time2)->value)
- return INT2FIX(0);
t = (double)tobj1->tv.tv_sec + (double)tobj1->tv.tv_usec*1e-6;
- if (tobj1->tv.tv_sec == (time_t)RFLOAT(time2)->value)
- return INT2FIX(0);
- if (tobj1->tv.tv_sec > (time_t)RFLOAT(time2)->value)
+ if (t > RFLOAT(time2)->value)
return INT2FIX(1);
- return INT2FIX(-1);
+ if (t < RFLOAT(time2)->value)
+ return INT2FIX(-1);
+ return INT2FIX(0);
}
}
@@ -504,15 +510,15 @@ static VALUE
time_clone(time)
VALUE time;
{
- VALUE obj;
- struct time_object *tobj, *newtobj;
+ VALUE clone;
+ struct time_object *tobj, *tclone;
GetTimeval(time, tobj);
- obj = Data_Make_Struct(0, struct time_object, 0, free, newtobj);
- CLONESETUP(obj, time);
- MEMCPY(newtobj, tobj, struct time_object, 1);
+ clone = Data_Make_Struct(0, struct time_object, 0, free, tclone);
+ CLONESETUP(clone, time);
+ MEMCPY(tclone, tobj, struct time_object, 1);
- return obj;
+ return clone;
}
static VALUE
@@ -524,6 +530,9 @@ time_localtime(time)
time_t t;
GetTimeval(time, tobj);
+ if (tobj->tm_got && !tobj->gmt) {
+ return time;
+ }
t = tobj->tv.tv_sec;
tm_tmp = localtime(&t);
tobj->tm = *tm_tmp;
@@ -541,6 +550,9 @@ time_gmtime(time)
time_t t;
GetTimeval(time, tobj);
+ if (tobj->tm_got && tobj->gmt) {
+ return time;
+ }
t = tobj->tv.tv_sec;
tm_tmp = gmtime(&t);
tobj->tm = *tm_tmp;
diff --git a/version.h b/version.h
index 212a164f60..106e7249b0 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.4.5"
-#define RUBY_RELEASE_DATE "2000-06-23"
+#define RUBY_RELEASE_DATE "2000-06-24"
#define RUBY_VERSION_CODE 145
-#define RUBY_RELEASE_CODE 20000623
+#define RUBY_RELEASE_CODE 20000624