⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.25
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
/
Process
/
View File Name :
clock_gettime-c.ri
U:RDoc::AnyMethod[iI"clock_gettime:ETI"Process::clock_gettime;TT:publico:RDoc::Markup::Document:@parts[#o:RDoc::Markup::Paragraph; [I"?Returns a time returned by POSIX clock_gettime() function.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"7p Process.clock_gettime(Process::CLOCK_MONOTONIC) ;TI"#=> 896053.968060096 ;T:@format0o; ; [I"++clock_id+ specifies a kind of clock. ;TI"RIt is specified as a constant which begins with <code>Process::CLOCK_</code> ;TI"Bsuch as Process::CLOCK_REALTIME and Process::CLOCK_MONOTONIC.;T@o; ; [I"8The supported constants depends on OS and version. ;TI">Ruby provides following types of +clock_id+ if available.;T@o:RDoc::Markup::List: @type: LABEL:@items[o:RDoc::Markup::ListItem:@label[I"CLOCK_REALTIME;T; [o; ; [I"PSUSv2 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, OpenBSD 2.1, macOS 10.12;To;;[I"CLOCK_MONOTONIC;T; [o; ; [I"PSUSv3 to 4, Linux 2.5.63, FreeBSD 3.0, NetBSD 2.0, OpenBSD 3.4, macOS 10.12;To;;[I"CLOCK_PROCESS_CPUTIME_ID;T; [o; ; [I"DSUSv3 to 4, Linux 2.5.63, FreeBSD 9.3, OpenBSD 5.4, macOS 10.12;To;;[I"CLOCK_THREAD_CPUTIME_ID;T; [o; ; [I"DSUSv3 to 4, Linux 2.5.63, FreeBSD 7.1, OpenBSD 5.4, macOS 10.12;To;;[I"CLOCK_VIRTUAL;T; [o; ; [I"FreeBSD 3.0, OpenBSD 2.1;To;;[I"CLOCK_PROF;T; [o; ; [I"FreeBSD 3.0, OpenBSD 2.1;To;;[I"CLOCK_REALTIME_FAST;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_REALTIME_PRECISE;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_REALTIME_COARSE;T; [o; ; [I"Linux 2.6.32;To;;[I"CLOCK_REALTIME_ALARM;T; [o; ; [I"Linux 3.0;To;;[I"CLOCK_MONOTONIC_FAST;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_MONOTONIC_PRECISE;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_MONOTONIC_COARSE;T; [o; ; [I"Linux 2.6.32;To;;[I"CLOCK_MONOTONIC_RAW;T; [o; ; [I"Linux 2.6.28, macOS 10.12;To;;[I"CLOCK_MONOTONIC_RAW_APPROX;T; [o; ; [I"macOS 10.12;To;;[I"CLOCK_BOOTTIME;T; [o; ; [I"Linux 2.6.39;To;;[I"CLOCK_BOOTTIME_ALARM;T; [o; ; [I"Linux 3.0;To;;[I"CLOCK_UPTIME;T; [o; ; [I"FreeBSD 7.0, OpenBSD 5.5;To;;[I"CLOCK_UPTIME_FAST;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_UPTIME_RAW;T; [o; ; [I"macOS 10.12;To;;[I"CLOCK_UPTIME_RAW_APPROX;T; [o; ; [I"macOS 10.12;To;;[I"CLOCK_UPTIME_PRECISE;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_SECOND;T; [o; ; [I"FreeBSD 8.1;To;;[I"CLOCK_TAI;T; [o; ; [I"Linux 3.10;T@o; ; [ I"9Note that SUS stands for Single Unix Specification. ;TI"HSUS contains POSIX and clock_gettime is defined in the POSIX part. ;TI".SUS defines CLOCK_REALTIME mandatory but ;TI"XCLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID are optional.;T@o; ; [I"7Also, several symbols are accepted as +clock_id+. ;TI".There are emulations for clock_gettime().;T@o; ; [I"8For example, Process::CLOCK_REALTIME is defined as ;TI"P+:GETTIMEOFDAY_BASED_CLOCK_REALTIME+ when clock_gettime() is not available.;T@o; ; [I"%Emulations for +CLOCK_REALTIME+:;To;;;;[o;;[I"':GETTIMEOFDAY_BASED_CLOCK_REALTIME;T; [o; ; [I"(Use gettimeofday() defined by SUS. ;TI"#(SUSv4 obsoleted it, though.) ;TI"%The resolution is 1 microsecond.;To;;[I":TIME_BASED_CLOCK_REALTIME;T; [o; ; [I""Use time() defined by ISO C. ;TI" The resolution is 1 second.;T@o; ; [I"&Emulations for +CLOCK_MONOTONIC+:;To;;;;[o;;[I".:MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC;T; [o; ; [I"4Use mach_absolute_time(), available on Darwin. ;TI"%The resolution is CPU dependent.;To;;[I"!:TIMES_BASED_CLOCK_MONOTONIC;T; [o; ; [I"7Use the result value of times() defined by POSIX. ;TI"�POSIX defines it as "times() shall return the elapsed real time, in clock ticks, since an arbitrary point in the past (for example, system start-up time)". ;TI"RFor example, GNU/Linux returns a value based on jiffies and it is monotonic. ;TI"BHowever, 4.4BSD uses gettimeofday() and it is not monotonic. ;TI"D(FreeBSD uses clock_gettime(CLOCK_MONOTONIC) instead, though.) ;TI"'The resolution is the clock tick. ;TI"A"getconf CLK_TCK" command shows the clock ticks per second. ;TI"K(The clock ticks per second is defined by HZ macro in older systems.) ;TI"\If it is 100 and clock_t is 32 bits integer type, the resolution is 10 millisecond and ;TI"$cannot represent over 497 days.;T@o; ; [I"/Emulations for +CLOCK_PROCESS_CPUTIME_ID+:;To;;;;[o;;[I".:GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID;T; [o; ; [ I"%Use getrusage() defined by SUS. ;TI"Fgetrusage() is used with RUSAGE_SELF to obtain the time only for ;TI"Cthe calling process (excluding the time for child processes). ;TI"PThe result is addition of user time (ru_utime) and system time (ru_stime). ;TI"%The resolution is 1 microsecond.;To;;[I"*:TIMES_BASED_CLOCK_PROCESS_CPUTIME_ID;T; [o; ; [I"#Use times() defined by POSIX. ;TI"RThe result is addition of user time (tms_utime) and system time (tms_stime). ;TI"Ttms_cutime and tms_cstime are ignored to exclude the time for child processes. ;TI"'The resolution is the clock tick. ;TI"A"getconf CLK_TCK" command shows the clock ticks per second. ;TI"K(The clock ticks per second is defined by HZ macro in older systems.) ;TI"4If it is 100, the resolution is 10 millisecond.;To;;[I"*:CLOCK_BASED_CLOCK_PROCESS_CPUTIME_ID;T; [o; ; [I"#Use clock() defined by ISO C. ;TI")The resolution is 1/CLOCKS_PER_SEC. ;TI"<CLOCKS_PER_SEC is the C-level macro defined by time.h. ;TI",SUS defines CLOCKS_PER_SEC is 1000000. ;TI"?Non-Unix systems may define it a different value, though. ;TI"KIf CLOCKS_PER_SEC is 1000000 as SUS, the resolution is 1 microsecond. ;TI"kIf CLOCKS_PER_SEC is 1000000 and clock_t is 32 bits integer type, it cannot represent over 72 minutes.;T@o; ; [I"GIf the given +clock_id+ is not supported, Errno::EINVAL is raised.;T@o; ; [I"1+unit+ specifies a type of the return value.;T@o;;;;[o;;[I":float_second;T; [o; ; [I"+number of seconds as a float (default);To;;[I":float_millisecond;T; [o; ; [I"&number of milliseconds as a float;To;;[I":float_microsecond;T; [o; ; [I"&number of microseconds as a float;To;;[I":second;T; [o; ; [I"$number of seconds as an integer;To;;[I":millisecond;T; [o; ; [I")number of milliseconds as an integer;To;;[I":microsecond;T; [o; ; [I")number of microseconds as an integer;To;;[I":nanosecond;T; [o; ; [I"(number of nanoseconds as an integer;T@o; ; [ I"PThe underlying function, clock_gettime(), returns a number of nanoseconds. ;TI"?Float object (IEEE 754 double) is not enough to represent ;TI"*the return value for CLOCK_REALTIME. ;TI"RIf the exact nanoseconds value is required, use +:nanoseconds+ as the +unit+.;T@o; ; [I"5The origin (zero) of the returned value varies. ;TI"NFor example, system start up time, process start up time, the Epoch, etc.;T@o; ; [ I":The origin in CLOCK_REALTIME is defined as the Epoch ;TI" (1970-01-01 00:00:00 UTC). ;TI"=But some systems count leap seconds and others doesn't. ;TI"BSo the result can be interpreted differently across systems. ;TI"1Time.now is recommended over CLOCK_REALTIME.;T: @fileI"process.c;T:0@omit_headings_from_table_of_contents_below0I":Process.clock_gettime(clock_id [, unit]) -> number ;T0[ I"(*args);T@vFI"Process;TcRDoc::NormalModule00