/*
* call-seq:
* time.to_a => array
*
* Returns a ten-element <i>array</i> of values for <i>time</i>:
* {<code>[ sec, min, hour, day, month, year, wday, yday, isdst, zone
* ]</code>}. See the individual methods for an explanation of the
* valid ranges of each value. The ten elements can be passed directly
* to <code>Time::utc</code> or <code>Time::local</code> to create a
* new <code>Time</code>.
*
* now = Time.now #=> Wed Apr 09 08:56:04 CDT 2003
* t = now.to_a #=> [4, 56, 8, 9, 4, 2003, 3, 99, true, "CDT"]
*/
static VALUE
time_to_a(time)
VALUE time;
{
struct time_object *tobj;
GetTimeval(time, tobj);
if (tobj->tm_got == 0) {
time_get_tm(time, tobj->gmt);
}
return rb_ary_new3(10,
INT2FIX(tobj->tm.tm_sec),
INT2FIX(tobj->tm.tm_min),
INT2FIX(tobj->tm.tm_hour),
INT2FIX(tobj->tm.tm_mday),
INT2FIX(tobj->tm.tm_mon+1),
LONG2NUM((long)tobj->tm.tm_year+1900),
INT2FIX(tobj->tm.tm_wday),
INT2FIX(tobj->tm.tm_yday+1),
tobj->tm.tm_isdst?Qtrue:Qfalse,
time_zone(time));
}