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.
8532 8533 8534 8535 8536 8537 8538 8539 8540 8541 8542 8543 8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 |
# File 'date_core.c', line 8532
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.
8562 8563 8564 8565 8566 8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 8594 8595 |
# File 'date_core.c', line 8562
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.
8520 8521 8522 8523 8524 |
# File 'date_core.c', line 8520
static VALUE
time_to_time(VALUE self)
{
return self;
}
|