method
inspect
ruby latest stable - Class:
Time
inspect()public
Returns a string representing time. Equivalent to calling #strftime with the appropriate format string.
t = Time .now t.to_s => "2012年11月10日 18:16:12 +0100" t.strftime "%Y-%m-%d %H:%M:%S %z" => "2012年11月10日 18:16:12 +0100" t.utc .to_s => "2012年11月10日 17:16:12 UTC" t.strftime "%Y-%m-%d %H:%M:%S UTC" => "2012年11月10日 17:16:12 UTC"
static VALUE
time_to_s(VALUE time)
{
struct time_object *tobj;
GetTimeval(time, tobj);
if (TIME_UTC_P(tobj))
return strftimev("%Y-%m-%d %H:%M:%S UTC", time, rb_usascii_encoding());
else
return strftimev("%Y-%m-%d %H:%M:%S %z", time, rb_usascii_encoding());
}