Method: Time#sec

Defined in:
time.c

#secInteger

Returns the integer second of the minute for self, in range (0..60):

t = Time.new(2000, 1, 2, 3, 4, 5, 6)
# => 2000-01-02 03:04:05 +000006
t.sec # => 5

Note: the second value may be 60 when there is a leap second.

Related: Time#year, Time#mon, Time#min.

Returns:


4688
4689
4690
4691
4692
4693
4694
4695
4696
# File 'time.c', line 4688

static VALUE
time_sec(VALUE time)
{
    struct time_object *tobj;

    GetTimeval(time, tobj);
    MAKE_TM(time, tobj);
    return INT2FIX(tobj->vtm.sec);
}