Class: Time
- Inherits:
-
Object
- Object
- Time
- Defined in:
- (unknown)
Instance Method Summary collapse
-
#to_date ⇒ Object
Returns a Date object which denotes self.
-
#to_datetime ⇒ Object
Returns a DateTime object which denotes self.
-
#to_time ⇒ Time
Returns self.
Instance Method Details
#to_date ⇒ Object
Returns a Date object which denotes self.
8695 8696 8697 8698 8699 8700 8701 8702 8703 8704 8705 8706 8707 8708 8709 8710 8711 8712 8713 8714 8715 8716 8717 |
# File 'ext/date/date_core.c', line 8695
static VALUE
time_to_date(VALUE self)
{
VALUE y, nth, ret;
int ry, m, d;
y = f_year(self);
m = FIX2INT(f_mon(self));
d = FIX2INT(f_mday(self));
decode_year(y, -1, &nth, &ry);
ret = d_simple_new_internal(cDate,
nth, 0,
GREGORIAN,
ry, m, d,
HAVE_CIVIL);
{
get_d1(ret);
set_sg(dat, DEFAULT_SG);
}
return ret;
}
|
#to_datetime ⇒ Object
Returns a DateTime object which denotes self.
8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 |
# File 'ext/date/date_core.c', line 8725
static VALUE
time_to_datetime(VALUE self)
{
VALUE y, sf, nth, ret;
int ry, m, d, h, min, s, of;
y = f_year(self);
m = FIX2INT(f_mon(self));
d = FIX2INT(f_mday(self));
h = FIX2INT(f_hour(self));
min = FIX2INT(f_min(self));
s = FIX2INT(f_sec(self));
if (s == 60)
s = 59;
sf = sec_to_ns(f_subsec(self));
of = FIX2INT(f_utc_offset(self));
decode_year(y, -1, &nth, &ry);
ret = d_complex_new_internal(cDateTime,
nth, 0,
0, sf,
of, DEFAULT_SG,
ry, m, d,
h, min, s,
HAVE_CIVIL | HAVE_TIME);
{
get_d1(ret);
set_sg(dat, DEFAULT_SG);
}
return ret;
}
|
#to_time ⇒ Time
Returns self.
8683 8684 8685 8686 8687 |
# File 'ext/date/date_core.c', line 8683
static VALUE
time_to_time(VALUE self)
{
return self;
}
|