⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.13
Server IP:
109.199.105.153
Server:
Linux connect.inboxifs.com 5.15.0-152-generic #162-Ubuntu SMP Wed Jul 23 09:48:42 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.29
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
Time
/
View File Name :
cdesc-Time.ri
U:RDoc::NormalClass[iI" Time:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[ : @fileI""ext/json/lib/json/add/time.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ ; I"lib/time.rb;T; 0o;;[Io:RDoc::Markup::Paragraph;[I"MTime is an abstraction of dates and times. Time is stored internally as ;TI"=the number of seconds with subsecond since the _Epoch_, ;TI"1970-01-01 00:00:00 UTC.;To:RDoc::Markup::BlankLine o;;[ I"The Time class treats GMT ;TI"O(Greenwich Mean Time) and UTC (Coordinated Universal Time) as equivalent. ;TI"OGMT is the older way of referring to these baseline times but persists in ;TI")the names of calls on POSIX systems.;T@o;;[ I"NAll times may have subsecond. Be aware of this fact when comparing times ;TI"Nwith each other -- times that are apparently equal when displayed may be ;TI"different when compared. ;TI"9(Since Ruby 2.7.0, Time#inspect shows subsecond but ;TI"-Time#to_s still doesn't show subsecond.);T@o;;[I"ISince Ruby 1.9.2, Time implementation uses a signed 63 bit integer, ;TI"Bignum or Rational. ;TI"HThe integer is a number of nanoseconds since the _Epoch_ which can ;TI")represent 1823-11-12 to 2116-02-20. ;TI"EWhen Bignum or Rational is used (before 1823, after 2116, under ;TI"<nanosecond), Time works slower as when integer is used.;T@S:RDoc::Markup::Heading: leveli: textI" Examples;T@o;;[I"KAll of these examples were done using the EST timezone which is GMT-5.;T@S; ;i;I"!Creating a new Time instance;T@o;;[I"LYou can create a new instance of Time with Time.new. This will use the ;TI"Fcurrent system time. Time.now is an alias for this. You can also ;TI"Opass parts of the time to Time.new such as year, month, minute, etc. When ;TI"Qyou want to construct a time this way you must pass at least a year. If you ;TI"Qpass the year with nothing else time will default to January 1 of that year ;TI"Jat 00:00:00 with the current system timezone. Here are some examples:;T@o:RDoc::Markup::Verbatim;[I":Time.new(2002) #=> 2002-01-01 00:00:00 -0500 ;TI":Time.new(2002, 10) #=> 2002-10-01 00:00:00 -0500 ;TI":Time.new(2002, 10, 31) #=> 2002-10-31 00:00:00 -0500 ;T:@format0o;;[I"You can pass a UTC offset:;T@o;;[I"MTime.new(2002, 10, 31, 2, 2, 2, "+02:00") #=> 2002-10-31 02:02:02 +0200 ;T;0o;;[I"Or a timezone object:;T@o;;[I"Ctz = timezone("Europe/Athens") # Eastern European Time, UTC+2 ;TI"GTime.new(2002, 10, 31, 2, 2, 2, tz) #=> 2002-10-31 02:02:02 +0200 ;T;0o;;[I"7You can also use Time.local and Time.utc to infer ;TI"Alocal and UTC timezones instead of using the current system ;TI" setting.;T@o;;[I"LYou can also create a new time using Time.at which takes the number of ;TI".seconds (with subsecond) since the {Unix ;TI"5Epoch}[https://en.wikipedia.org/wiki/Unix_time].;T@o;;[I"6Time.at(628232400) #=> 1989-11-28 00:00:00 -0500 ;T;0S; ;i;I"%Working with an instance of Time;T@o;;[I"NOnce you have an instance of Time there is a multitude of things you can ;TI"Pdo with it. Below are some examples. For all of the following examples, we ;TI"Bwill work on the assumption that you have done the following:;T@o;;[I"4t = Time.new(1993, 02, 24, 12, 0, 0, "+09:00") ;T;0o;;[I"Was that a monday?;T@o;;[I"t.monday? #=> false ;T;0o;;[I"What year was that again?;T@o;;[I"t.year #=> 1993 ;T;0o;;[I")Was it daylight savings at the time?;T@o;;[I"t.dst? #=> false ;T;0o;;[I"!What's the day a year later?;T@o;;[I"6t + (60*60*24*365) #=> 1994-02-24 12:00:00 +0900 ;T;0o;;[I"4How many seconds was that since the Unix Epoch?;T@o;;[I"t.to_i #=> 730522800 ;T;0o;;[I"?You can also do standard functions like compare two times.;T@o;;[I"t1 = Time.new(2010) ;TI"t2 = Time.new(2011) ;TI" ;TI"t1 == t2 #=> false ;TI"t1 == t1 #=> true ;TI"t1 < t2 #=> true ;TI"t1 > t2 #=> false ;TI" ;TI"4Time.new(2010,10,31).between?(t1, t2) #=> true ;T;0S; ;i;I"Timezone argument;T@o;;[I"EA timezone argument must have +local_to_utc+ and +utc_to_local+ ;TI">methods, and may have +name+, +abbr+, and +dst?+ methods.;T@o;;[I"FThe +local_to_utc+ method should convert a Time-like object from ;TI"Cthe timezone to UTC, and +utc_to_local+ is the opposite. The ;TI"Hresult also should be a Time or Time-like object (not necessary to ;TI"Cbe the same class). The #zone of the result is just ignored. ;TI"HTime-like argument to these methods is similar to a Time object in ;TI"DUTC without subsecond; it has attribute readers for the parts, ;TI"He.g. #year, #month, and so on, and epoch time readers, #to_i. The ;TI"Bsubsecond attributes are fixed as 0, and #utc_offset, #zone, ;TI"A#isdst, and their aliases are same as a Time object in UTC. ;TI"3Also #to_time, #+, and #- methods are defined.;T@o;;[I"EThe +name+ method is used for marshaling. If this method is not ;TI"Ddefined on a timezone object, Time objects using that timezone ;TI")object can not be dumped by Marshal.;T@o;;[I"4The +abbr+ method is used by '%Z' in #strftime.;T@o;;[I"OThe +dst?+ method is called with a +Time+ value and should return whether ;TI">the +Time+ value is in daylight savings time in the zone.;T@S; ;i;I" Auto conversion to Timezone;T@o;;[I"PAt loading marshaled data, a timezone name will be converted to a timezone ;TI"Fobject by +find_timezone+ class method, if the method is defined.;T@o;;[I"OSimilarly, that class method will be called when a timezone argument does ;TI"4not have the necessary methods mentioned above.;T; I"time.c;T; 0; 0; 0[ [ [[I"Comparable;To;;[ ; @�; 0I"time.c;T[[I" class;T[[:public[[I"at;T@�[I"gm;T@�[I" httpdate;TI"lib/time.rb;T[I"iso8601;T@�[I"json_create;TI""ext/json/lib/json/add/time.rb;T[I" local;T@�[I"mktime;T@�[I"new;T@�[I"now;T@�[I" parse;T@�[I"rfc2822;T@�[I"rfc822;T@�[I" strptime;T@�[I"utc;T@�[I"xmlschema;T@�[I"zone_offset;T@�[:protected[ [:private[ [I"apply_offset;T@�[I"force_zone!;T@�[I"make_time;T@�[I"month_days;T@�[I"zone_utc?;T@�[I" instance;T[[;[F[I"+;T@�[I"-;T@�[I"<=>;T@�[I"as_json;T@�[I"asctime;T@�[I" ceil;T@�[I" ctime;T@�[I"day;T@�[I" dst?;T@�[I" eql?;T@�[I" floor;T@�[I"friday?;T@�[I" getgm;T@�[I" getlocal;T@�[I"getutc;T@�[@�@�[I" gmt?;T@�[I"gmt_offset;T@�[I"gmtime;T@�[I"gmtoff;T@�[I" hash;T@�[I" hour;T@�[I" httpdate;T@�[I"inspect;T@�[I" isdst;T@�[I"iso8601;T@�[I"localtime;T@�[I" mday;T@�[I"min;T@�[I"mon;T@�[I"monday?;T@�[I" month;T@�[I" nsec;T@�[I"rfc2822;T@�[I"rfc822;T@�[I" round;T@�[I"saturday?;T@�[I"sec;T@�[I" strftime;T@�[I"subsec;T@�[I"sunday?;T@�[I"thursday?;T@�[I" to_a;T@�[I"to_date;TI"ext/date/date_core.c;T[I"to_datetime;T@P[I" to_f;T@�[I" to_i;T@�[I"to_json;T@�[I" to_r;T@�[I" to_s;T@�[I"to_time;T@P[I" tuesday?;T@�[I"tv_nsec;T@�[I"tv_sec;T@�[I"tv_usec;T@�[I" usec;T@�[I"utc;T@�[I" utc?;T@�[I"utc_offset;T@�[I" wday;T@�[I"wednesday?;T@�[I"xmlschema;T@�[I" yday;T@�[I" year;T@�[I" zone;T@�[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0; 0[ I"ext/date/date_core.c;T@ I"lib/cgi/session.rb;T@@�@�cRDoc::TopLevel