summaryrefslogtreecommitdiff
path: root/ext/date
diff options
context:
space:
mode:
Diffstat (limited to 'ext/date')
-rw-r--r--ext/date/date_core.c142
-rw-r--r--ext/date/date_strftime.c131
-rw-r--r--ext/date/depend4
-rw-r--r--ext/date/extconf.rb1
4 files changed, 136 insertions, 142 deletions
diff --git a/ext/date/date_core.c b/ext/date/date_core.c
index 774819d13a..a254d3e220 100644
--- a/ext/date/date_core.c
+++ b/ext/date/date_core.c
@@ -2402,16 +2402,16 @@ d_lite_inspect(VALUE self)
}
#include <errno.h>
-#include "timev.h"
+#include "date_tmx.h"
size_t
date_strftime(char *s, size_t maxsize, const char *format,
- const struct vtm *vtm, VALUE timev);
+ const struct tmx *tmx);
#define SMALLBUF 100
static size_t
date_strftime_alloc(char **buf, const char *format,
- struct vtm *vtm, VALUE timev)
+ struct tmx *tmx)
{
size_t size, len, flen;
@@ -2421,12 +2421,12 @@ date_strftime_alloc(char **buf, const char *format,
return 0;
}
errno = 0;
- len = date_strftime(*buf, SMALLBUF, format, vtm, timev);
+ len = date_strftime(*buf, SMALLBUF, format, tmx);
if (len != 0 || (**buf == '\0' && errno != ERANGE)) return len;
for (size=1024; ; size*=2) {
*buf = xmalloc(size);
(*buf)[0] = '\0';
- len = date_strftime(*buf, size, format, vtm, timev);
+ len = date_strftime(*buf, size, format, tmx);
/*
* buflen can be zero EITHER because there's not enough
* room in the string, or because the control command
@@ -2441,52 +2441,49 @@ date_strftime_alloc(char **buf, const char *format,
}
static void
-d_lite_set_vtm_and_timev(VALUE self, struct vtm *vtm, VALUE *timev)
+d_lite_set_tmx(VALUE self, struct tmx *tmx)
{
get_d1(self);
if (!light_mode_p(dat)) {
- vtm->year = iforward0("year_r");
- vtm->mon = FIX2INT(iforward0("mon_r"));
- vtm->mday = FIX2INT(iforward0("mday_r"));
- vtm->hour = FIX2INT(iforward0("hour_r"));
- vtm->min = FIX2INT(iforward0("min_r"));
- vtm->sec = FIX2INT(iforward0("sec_r"));
- vtm->subsecx = iforward0("sec_fraction_r");
- vtm->utc_offset = INT2FIX(0);
- vtm->wday = FIX2INT(iforward0("wday_r"));
- vtm->yday = FIX2INT(iforward0("yday_r"));
- vtm->isdst = 0;
- vtm->zone = RSTRING_PTR(iforward0("zone_r"));
- *timev = f_mul(f_sub(dat->r.ajd,
- rb_rational_new2(INT2FIX(4881175), INT2FIX(2))),
- INT2FIX(86400));
+ tmx->year = iforward0("year_r");
+ tmx->yday = FIX2INT(iforward0("yday_r"));
+ tmx->mon = FIX2INT(iforward0("mon_r"));
+ tmx->mday = FIX2INT(iforward0("mday_r"));
+ tmx->hour = FIX2INT(iforward0("hour_r"));
+ tmx->min = FIX2INT(iforward0("min_r"));
+ tmx->sec = FIX2INT(iforward0("sec_r"));
+ tmx->wday = FIX2INT(iforward0("wday_r"));
+ tmx->offset = INT2FIX(0);
+ tmx->zone = RSTRING_PTR(iforward0("zone_r"));
+ tmx->timev = f_mul(f_sub(dat->r.ajd,
+ rb_rational_new2(INT2FIX(4881175),
+ INT2FIX(2))),
+ INT2FIX(86400));
}
else {
get_d_jd(dat);
get_d_civil(dat);
- vtm->year = LONG2NUM(dat->l.year);
- vtm->mon = dat->l.mon;
- vtm->mday = dat->l.mday;
- vtm->hour = 0;
- vtm->min = 0;
- vtm->sec = 0;
- vtm->subsecx = INT2FIX(0);
- vtm->utc_offset = INT2FIX(0);
- vtm->wday = jd_to_wday(dat->l.jd);
- vtm->yday = civil_to_yday(dat->l.year, dat->l.mon, dat->l.mday);
- vtm->isdst = 0;
- vtm->zone = "+00:00";
- *timev = f_mul(INT2FIX(dat->l.jd - 2440588),
- INT2FIX(86400));
+ tmx->year = LONG2NUM(dat->l.year);
+ tmx->yday = civil_to_yday(dat->l.year, dat->l.mon, dat->l.mday);
+ tmx->mon = dat->l.mon;
+ tmx->mday = dat->l.mday;
+ tmx->hour = 0;
+ tmx->min = 0;
+ tmx->sec = 0;
+ tmx->wday = jd_to_wday(dat->l.jd);
+ tmx->offset = INT2FIX(0);
+ tmx->zone = "+00:00";
+ tmx->timev = f_mul(INT2FIX(dat->l.jd - 2440588),
+ INT2FIX(86400));
}
}
static VALUE
date_strftime_internal(int argc, VALUE *argv, VALUE self,
const char *default_fmt,
- void (*func)(VALUE, struct vtm *, VALUE *))
+ void (*func)(VALUE, struct tmx *))
{
get_d1(self);
{
@@ -2494,8 +2491,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
const char *fmt;
long len;
char buffer[SMALLBUF], *buf = buffer;
- struct vtm vtm;
- VALUE timev;
+ struct tmx tmx;
VALUE str;
rb_scan_args(argc, argv, "01", &vfmt);
@@ -2511,14 +2507,14 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
}
fmt = RSTRING_PTR(vfmt);
len = RSTRING_LEN(vfmt);
- (*func)(self, &vtm, &timev);
+ (*func)(self, &tmx);
if (memchr(fmt, '\0', len)) {
/* Ruby string may contain \0's. */
const char *p = fmt, *pe = fmt + len;
str = rb_str_new(0, 0);
while (p < pe) {
- len = date_strftime_alloc(&buf, p, &vtm, timev);
+ len = date_strftime_alloc(&buf, p, &tmx);
rb_str_cat(str, buf, len);
p += strlen(p);
if (buf != buffer) {
@@ -2531,7 +2527,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
return str;
}
else
- len = date_strftime_alloc(&buf, fmt, &vtm, timev);
+ len = date_strftime_alloc(&buf, fmt, &tmx);
str = rb_str_new(buf, len);
if (buf != buffer) xfree(buf);
@@ -2550,7 +2546,7 @@ static VALUE
d_lite_strftime(int argc, VALUE *argv, VALUE self)
{
return date_strftime_internal(argc, argv, self,
- "%F", d_lite_set_vtm_and_timev);
+ "%F", d_lite_set_tmx);
}
/*
@@ -4046,47 +4042,45 @@ dt_lite_inspect(VALUE self)
}
static void
-dt_lite_set_vtm_and_timev(VALUE self, struct vtm *vtm, VALUE *timev)
+dt_lite_set_tmx(VALUE self, struct tmx *tmx)
{
get_dt1(self);
if (!light_mode_p(dat)) {
- vtm->year = iforward0("year_r");
- vtm->mon = FIX2INT(iforward0("mon_r"));
- vtm->mday = FIX2INT(iforward0("mday_r"));
- vtm->hour = FIX2INT(iforward0("hour_r"));
- vtm->min = FIX2INT(iforward0("min_r"));
- vtm->sec = FIX2INT(iforward0("sec_r"));
- vtm->subsecx = iforward0("sec_fraction_r");
- vtm->utc_offset = INT2FIX(0);
- vtm->wday = FIX2INT(iforward0("wday_r"));
- vtm->yday = FIX2INT(iforward0("yday_r"));
- vtm->isdst = 0;
- vtm->zone = RSTRING_PTR(iforward0("zone_r"));
- *timev = f_mul(f_sub(dat->r.ajd,
- rb_rational_new2(INT2FIX(4881175), INT2FIX(2))),
- INT2FIX(86400));
+ tmx->year = iforward0("year_r");
+ tmx->yday = FIX2INT(iforward0("yday_r"));
+ tmx->mon = FIX2INT(iforward0("mon_r"));
+ tmx->mday = FIX2INT(iforward0("mday_r"));
+ tmx->hour = FIX2INT(iforward0("hour_r"));
+ tmx->min = FIX2INT(iforward0("min_r"));
+ tmx->sec = FIX2INT(iforward0("sec_r"));
+ tmx->wday = FIX2INT(iforward0("wday_r"));
+ tmx->offset = INT2FIX(0);
+ tmx->zone = RSTRING_PTR(iforward0("zone_r"));
+ tmx->timev = f_mul(f_sub(dat->r.ajd,
+ rb_rational_new2(INT2FIX(4881175),
+ INT2FIX(2))),
+ INT2FIX(86400));
}
else {
get_dt_jd(dat);
get_dt_civil(dat);
get_dt_time(dat);
- vtm->year = LONG2NUM(dat->l.year);
- vtm->mon = dat->l.mon;
- vtm->mday = dat->l.mday;
- vtm->hour = dat->l.hour;
- vtm->min = dat->l.min;
- vtm->sec = dat->l.sec;
- vtm->subsecx = LONG2NUM(dat->l.sf);
- vtm->utc_offset = INT2FIX(dat->l.of);
- vtm->wday = jd_to_wday(local_jd(dat));
- vtm->yday = civil_to_yday(dat->l.year, dat->l.mon, dat->l.mday);
- vtm->isdst = 0;
- vtm->zone = RSTRING_PTR(dt_lite_zone(self));
- *timev = f_mul(f_sub(dt_lite_ajd(self),
- rb_rational_new2(INT2FIX(4881175), INT2FIX(2))),
- INT2FIX(86400));
+ tmx->year = LONG2NUM(dat->l.year);
+ tmx->yday = civil_to_yday(dat->l.year, dat->l.mon, dat->l.mday);
+ tmx->mon = dat->l.mon;
+ tmx->mday = dat->l.mday;
+ tmx->hour = dat->l.hour;
+ tmx->min = dat->l.min;
+ tmx->sec = dat->l.sec;
+ tmx->wday = jd_to_wday(local_jd(dat));
+ tmx->offset = INT2FIX(dat->l.of);
+ tmx->zone = RSTRING_PTR(dt_lite_zone(self));
+ tmx->timev = f_mul(f_sub(dt_lite_ajd(self),
+ rb_rational_new2(INT2FIX(4881175),
+ INT2FIX(2))),
+ INT2FIX(86400));
}
}
@@ -4100,7 +4094,7 @@ static VALUE
dt_lite_strftime(int argc, VALUE *argv, VALUE self)
{
return date_strftime_internal(argc, argv, self,
- "%FT%T%:z", dt_lite_set_vtm_and_timev);
+ "%FT%T%:z", dt_lite_set_tmx);
}
/*
diff --git a/ext/date/date_strftime.c b/ext/date/date_strftime.c
index 083fd4b0e8..5bb84a1c2b 100644
--- a/ext/date/date_strftime.c
+++ b/ext/date/date_strftime.c
@@ -48,7 +48,7 @@
*/
#include "ruby/ruby.h"
-#include "timev.h"
+#include "date_tmx.h"
#ifndef GAWK
#include <stdio.h>
@@ -106,8 +106,8 @@ adddecl(static int iso8601wknum_v();)
#else
static int weeknumber(const struct tm *timeptr, int firstweekday);
adddecl(static int iso8601wknum(const struct tm *timeptr);)
-static int weeknumber_v(const struct vtm *vtm, int firstweekday);
-adddecl(static int iso8601wknum_v(const struct vtm *vtm);)
+static int weeknumber_v(const struct tmx *tmx, int firstweekday);
+adddecl(static int iso8601wknum_v(const struct tmx *tmx);)
#endif
#ifdef STDC_HEADERS
@@ -168,8 +168,8 @@ max(int a, int b)
/* strftime --- produce formatted time */
static size_t
-date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
- const struct vtm *vtm, VALUE timev)
+date_strftime_with_tmx(char *s, size_t maxsize, const char *format,
+ const struct tmx *tmx)
{
char *endp = s + maxsize;
char *start = s;
@@ -196,7 +196,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
};
static const char ampm[][3] = { "AM", "PM", };
- if (s == NULL || format == NULL || vtm == NULL || maxsize == 0)
+ if (s == NULL || format == NULL || tmx == NULL || maxsize == 0)
return 0;
/* quick check if we even need to bother */
@@ -235,7 +235,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
} while (0)
#define STRFTIME(fmt) \
do { \
- i = date_strftime_wo_timespec(s, endp - s, (fmt), vtm, timev); \
+ i = date_strftime_with_tmx(s, endp - s, (fmt), tmx); \
if (!i) return 0; \
if (precision > i) {\
if (start + maxsize < s + precision) { \
@@ -298,10 +298,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
flags |= BIT_OF(UPPER);
}
- if (vtm->wday < 0 || vtm->wday > 6)
+ if (tmx->wday < 0 || tmx->wday > 6)
i = 1, tp = "?";
else
- i = 3, tp = days_l[vtm->wday];
+ i = 3, tp = days_l[tmx->wday];
break;
case 'A': /* full weekday name */
@@ -309,10 +309,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
flags |= BIT_OF(UPPER);
}
- if (vtm->wday < 0 || vtm->wday > 6)
+ if (tmx->wday < 0 || tmx->wday > 6)
i = 1, tp = "?";
else
- i = strlen(tp = days_l[vtm->wday]);
+ i = strlen(tp = days_l[tmx->wday]);
break;
#ifdef SYSV_EXT
@@ -323,10 +323,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
flags |= BIT_OF(UPPER);
}
- if (vtm->mon < 1 || vtm->mon > 12)
+ if (tmx->mon < 1 || tmx->mon > 12)
i = 1, tp = "?";
else
- i = 3, tp = months_l[vtm->mon-1];
+ i = 3, tp = months_l[tmx->mon-1];
break;
case 'B': /* full month name */
@@ -334,10 +334,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(LOWER)|BIT_OF(CHCASE));
flags |= BIT_OF(UPPER);
}
- if (vtm->mon < 1 || vtm->mon > 12)
+ if (tmx->mon < 1 || tmx->mon > 12)
i = 1, tp = "?";
else
- i = strlen(tp = months_l[vtm->mon-1]);
+ i = strlen(tp = months_l[tmx->mon-1]);
break;
case 'c': /* appropriate date and time representation */
@@ -345,17 +345,17 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
continue;
case 'd': /* day of the month, 01 - 31 */
- i = range(1, vtm->mday, 31);
+ i = range(1, tmx->mday, 31);
FMT('0', 2, "d", (int)i);
continue;
case 'H': /* hour, 24-hour clock, 00 - 23 */
- i = range(0, vtm->hour, 23);
+ i = range(0, tmx->hour, 23);
FMT('0', 2, "d", (int)i);
continue;
case 'I': /* hour, 12-hour clock, 01 - 12 */
- i = range(0, vtm->hour, 23);
+ i = range(0, tmx->hour, 23);
if (i == 0)
i = 12;
else if (i > 12)
@@ -364,16 +364,16 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
continue;
case 'j': /* day of the year, 001 - 366 */
- FMT('0', 3, "d", vtm->yday);
+ FMT('0', 3, "d", tmx->yday);
continue;
case 'm': /* month, 01 - 12 */
- i = range(1, vtm->mon, 12);
+ i = range(1, tmx->mon, 12);
FMT('0', 2, "d", (int)i);
continue;
case 'M': /* minute, 00 - 59 */
- i = range(0, vtm->min, 59);
+ i = range(0, tmx->min, 59);
FMT('0', 2, "d", (int)i);
continue;
@@ -384,7 +384,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE));
flags |= BIT_OF(LOWER);
}
- i = range(0, vtm->hour, 23);
+ i = range(0, tmx->hour, 23);
if (i < 12)
tp = ampm[0];
else
@@ -394,14 +394,14 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
case 's':
{
- VALUE sec = div(timev, INT2FIX(1));
+ VALUE sec = div(tmx->timev, INT2FIX(1));
FMTV('0', 1, "d", sec);
}
continue;
case 'Q':
{
- VALUE sec = div(timev,
+ VALUE sec = div(tmx->timev,
rb_rational_new2(INT2FIX(1),
INT2FIX(1000)));
FMTV('0', 1, "d", sec);
@@ -409,21 +409,21 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
continue;
case 'S': /* second, 00 - 60 */
- i = range(0, vtm->sec, 60);
+ i = range(0, tmx->sec, 60);
FMT('0', 2, "d", (int)i);
continue;
case 'U': /* week of year, Sunday is first day of week */
- FMT('0', 2, "d", weeknumber_v(vtm, 0));
+ FMT('0', 2, "d", weeknumber_v(tmx, 0));
continue;
case 'w': /* weekday, Sunday == 0, 0 - 6 */
- i = range(0, vtm->wday, 6);
+ i = range(0, tmx->wday, 6);
FMT('0', 1, "d", (int)i);
continue;
case 'W': /* week of year, Monday is first day of week */
- FMT('0', 2, "d", weeknumber_v(vtm, 1));
+ FMT('0', 2, "d", weeknumber_v(tmx, 1));
continue;
case 'x': /* appropriate date representation */
@@ -435,17 +435,17 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
continue;
case 'y': /* year without a century, 00 - 99 */
- i = NUM2INT(mod(vtm->year, INT2FIX(100)));
+ i = NUM2INT(mod(tmx->year, INT2FIX(100)));
FMT('0', 2, "d", (int)i);
continue;
case 'Y': /* year with century */
- if (FIXNUM_P(vtm->year)) {
- long y = FIX2LONG(vtm->year);
+ if (FIXNUM_P(tmx->year)) {
+ long y = FIX2LONG(tmx->year);
FMT('0', 0 <= y ? 4 : 5, "ld", y);
}
else {
- FMTV('0', 4, "d", vtm->year);
+ FMTV('0', 4, "d", tmx->year);
}
continue;
@@ -455,7 +455,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
long aoff;
int hl, hw;
- off = NUM2LONG(rb_funcall(vtm->utc_offset, rb_intern("round"), 0));
+ off = NUM2LONG(rb_funcall(tmx->offset, rb_intern("round"), 0));
aoff = off;
if (aoff < 0)
@@ -547,10 +547,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
flags &= ~(BIT_OF(UPPER)|BIT_OF(CHCASE));
flags |= BIT_OF(LOWER);
}
- if (vtm->zone == NULL)
+ if (tmx->zone == NULL)
tp = "";
else
- tp = vtm->zone;
+ tp = tmx->zone;
i = strlen(tp);
break;
@@ -570,7 +570,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
continue;
case 'e': /* day of month, blank padded */
- FMT(' ', 2, "d", range(1, vtm->mday, 31));
+ FMT(' ', 2, "d", range(1, tmx->mday, 31));
continue;
case 'r': /* time as %I:%M:%S %p */
@@ -588,12 +588,12 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
#ifdef SUNOS_EXT
case 'k': /* hour, 24-hour clock, blank pad */
- i = range(0, vtm->hour, 23);
+ i = range(0, tmx->hour, 23);
FMT(' ', 2, "d", (int)i);
continue;
case 'l': /* hour, 12-hour clock, 1 - 12, blank pad */
- i = range(0, vtm->hour, 23);
+ i = range(0, tmx->hour, 23);
if (i == 0)
i = 12;
else if (i > 12)
@@ -612,7 +612,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
#ifdef POSIX2_DATE
case 'C':
- FMTV('0', 2, "d", div(vtm->year, INT2FIX(100)));
+ FMTV('0', 2, "d", div(tmx->year, INT2FIX(100)));
continue;
case 'E':
@@ -629,12 +629,12 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
goto again;
goto unknown;
case 'V': /* week of year according ISO 8601 */
- FMT('0', 2, "d", iso8601wknum_v(vtm));
+ FMT('0', 2, "d", iso8601wknum_v(tmx));
continue;
case 'u':
/* ISO 8601: Weekday as a decimal number [1 (Monday) - 7] */
- FMT('0', 1, "d", vtm->wday == 0 ? 7 : vtm->wday);
+ FMT('0', 1, "d", tmx->wday == 0 ? 7 : tmx->wday);
continue;
#endif /* POSIX2_DATE */
@@ -651,11 +651,11 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
* Otherwise, it's this year.
*/
{
- VALUE yv = vtm->year;
- w = iso8601wknum_v(vtm);
- if (vtm->mon == 12 && w == 1)
+ VALUE yv = tmx->year;
+ w = iso8601wknum_v(tmx);
+ if (tmx->mon == 12 && w == 1)
yv = add(yv, INT2FIX(1));
- else if (vtm->mon == 1 && w >= 52)
+ else if (tmx->mon == 1 && w >= 52)
yv = sub(yv, INT2FIX(1));
if (*format == 'G') {
@@ -699,7 +699,7 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
NEEDS(precision);
{
- VALUE subsec = mod(timev, INT2FIX(1));
+ VALUE subsec = mod(tmx->timev, INT2FIX(1));
int ww;
long n;
@@ -816,9 +816,10 @@ date_strftime_wo_timespec(char *s, size_t maxsize, const char *format,
}
size_t
-date_strftime(char *s, size_t maxsize, const char *format, const struct vtm *vtm, VALUE timev)
+date_strftime(char *s, size_t maxsize, const char *format,
+ const struct tmx *tmx)
{
- return date_strftime_wo_timespec(s, maxsize, format, vtm, timev);
+ return date_strftime_with_tmx(s, maxsize, format, tmx);
}
/* isleap --- is a year a leap year? */
@@ -837,26 +838,26 @@ isleap(long year)
static void
-vtm2tm_noyear(const struct vtm *vtm, struct tm *result)
+tmx2tm_noyear(const struct tmx *tmx, struct tm *result)
{
struct tm tm;
/* for isleap() in iso8601wknum. +100 is -1900 (mod 400). */
- tm.tm_year = FIX2INT(mod(vtm->year, INT2FIX(400))) + 100;
-
- tm.tm_mon = vtm->mon-1;
- tm.tm_mday = vtm->mday;
- tm.tm_hour = vtm->hour;
- tm.tm_min = vtm->min;
- tm.tm_sec = vtm->sec;
- tm.tm_wday = vtm->wday;
- tm.tm_yday = vtm->yday-1;
- tm.tm_isdst = vtm->isdst;
+ tm.tm_year = FIX2INT(mod(tmx->year, INT2FIX(400))) + 100;
+
+ tm.tm_mon = tmx->mon-1;
+ tm.tm_mday = tmx->mday;
+ tm.tm_hour = tmx->hour;
+ tm.tm_min = tmx->min;
+ tm.tm_sec = tmx->sec;
+ tm.tm_wday = tmx->wday;
+ tm.tm_yday = tmx->yday-1;
+ tm.tm_isdst = 0;
#if defined(HAVE_STRUCT_TM_TM_GMTOFF)
- tm.tm_gmtoff = NUM2LONG(vtm->utc_offset);
+ tm.tm_gmtoff = NUM2LONG(tmx->offset);
#endif
#if defined(HAVE_TM_ZONE)
- tm.tm_zone = (char *)vtm->zone;
+ tm.tm_zone = (char *)tmx->zone;
#endif
*result = tm;
}
@@ -978,10 +979,10 @@ iso8601wknum(const struct tm *timeptr)
}
static int
-iso8601wknum_v(const struct vtm *vtm)
+iso8601wknum_v(const struct tmx *tmx)
{
struct tm tm;
- vtm2tm_noyear(vtm, &tm);
+ tmx2tm_noyear(tmx, &tm);
return iso8601wknum(&tm);
}
@@ -1017,10 +1018,10 @@ weeknumber(const struct tm *timeptr, int firstweekday)
}
static int
-weeknumber_v(const struct vtm *vtm, int firstweekday)
+weeknumber_v(const struct tmx *tmx, int firstweekday)
{
struct tm tm;
- vtm2tm_noyear(vtm, &tm);
+ tmx2tm_noyear(tmx, &tm);
return weeknumber(&tm, firstweekday);
}
diff --git a/ext/date/depend b/ext/date/depend
index b694930eba..7e5d62e79d 100644
--- a/ext/date/depend
+++ b/ext/date/depend
@@ -1,2 +1,2 @@
-date_core.o: $(top_srcdir)/timev.h
-date_strftime.o: $(top_srcdir)/timev.h
+date_core.o: date_tmx.h
+date_strftime.o: date_tmx.h
diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb
index 3515a6e89a..9f7d3e8f0b 100644
--- a/ext/date/extconf.rb
+++ b/ext/date/extconf.rb
@@ -1,3 +1,2 @@
require 'mkmf'
-$INCFLAGS << " -I$(top_srcdir)"
create_makefile('date_core')