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.
8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 |
# File 'ext/date/date_core.c', line 8764
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.
8794 8795 8796 8797 8798 8799 8800 8801 8802 8803 8804 8805 8806 8807 8808 8809 8810 8811 8812 8813 8814 8815 8816 8817 8818 8819 8820 8821 8822 8823 8824 8825 8826 8827 |
# File 'ext/date/date_core.c', line 8794
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.
8752 8753 8754 8755 8756 |
# File 'ext/date/date_core.c', line 8752
static VALUE
time_to_time(VALUE self)
{
return self;
}
|