Name
Time — Time class
Synopsis
Time is an object corresponding to a
certain time. Internally, it’s stored as a number of seconds
since the epoch, 00:00:00, January 1, 1970 UTC.
Time class can handle both a system’s local
time and UTC at the same time, but no other time zones can be
handled.
Included Module
Comparable
Class Methods
Time::at(time[,usec=0])Creates a
Timeobject.timemay be aTimeobject or an integer representing the number of seconds elapsed since the epoch, 00:00:00, January 1, 1970 UTC.Time::gm(year[,month=1[,day=1[,hour=0[,min=0[,sec=0[,usec=0]]]]])see
Time::utc(year[,month=1[,day=1[,hour=0[,min=0[,sec=0 [,usec=]]]]]])Time::local(year[,month=1[,day=1[,hour=0[,min=0[,sec=0 [,usec=0]]]]]])Time::mktime(year[,month=1[,day=1[,hour=0[,min=0[,sec=0 [,usec=0]]]]]])Creates a
Timeobject interpreted in the local time zone.Time::newTime::nowCreates a
Timeobject expressing the current system time.Time::timesReturns a
Tmsstructure containing user and system CPU times retrieved by the times system call. Here are theTmsstructure members:utimeUser CPU time
stimeSystem CPU time
cutimeCPU time elapsed for user child processes
cstimeCPU time elapsed for system child processes
Time::utc(year[,month=1[,day=1[,hour=0[,min=0[,sec=0 [,usec=0]]]]]])Time::gm(year[,month=1[,day=1[,hour=0[,min=0[,sec=0[,usec=0]]]]])Creates a
Timeobject interpreted as UTC (Coordinated Universal Time, formally known as GMT).
Instance Methods
t+nReturns a
Timeobject withnnumber of seconds added.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access