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.
8884 8885 8886 8887 8888 8889 8890 8891 8892 8893 8894 8895 8896 8897 8898 8899 8900 8901 8902 8903 8904 8905 8906 |
# File 'ext/date/date_core.c', line 8884
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.
8914 8915 8916 8917 8918 8919 8920 8921 8922 8923 8924 8925 8926 8927 8928 8929 8930 8931 8932 8933 8934 8935 8936 8937 8938 8939 8940 8941 8942 8943 8944 8945 8946 8947 |
# File 'ext/date/date_core.c', line 8914
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, GREGORIAN,
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.
8872 8873 8874 8875 8876 |
# File 'ext/date/date_core.c', line 8872
static VALUE
time_to_time(VALUE self)
{
return self;
}
|