Method: Time.at

Defined in:
lib/source/ruby.rb

.at(seconds, milliseconds) ⇒ Object

call-seq:

Time.at(a_time)                   -> time
Time.at(seconds [, microseconds]) -> time

Creates a new time object with the value given by a_time, or the given number of seconds (and optional milliseconds) from epoch. A non-portable feature allows the offset to be negative on some systems.

Time.at(0)            #=> Wed Dec 31 1969 19:00:00 GMT-0500 (EST)
Time.at(946702800)    #=> Sat Jan 01 2000 00:00:00 GMT-0500 (EST)
Time.at(-284061600)   #=> Sat Dec 31 1960 01:00:00 GMT-0500 (EST)


6234
6235
6236
6237
6238
# File 'lib/source/ruby.rb', line 6234

def self.at(seconds,milliseconds)
  `var t=c$Time.m$new()`
  `t._value=typeof(seconds)=='number'?new(Date)(seconds*1000+(milliseconds||0)):seconds._value`
  return `t`
end