Add documents on Process::CLOCK_* constants

* process.c: Add documents on Process::CLOCK_* constants.
  Patch by Sunao Komuro <sunao-komuro@cookpad.com>.
  Closes [GH-1567] [Bug #13386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58208 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
sorah 2017-03-29 09:31:13 +00:00
parent 225435514c
commit af4b7c8e86

View File

@ -7805,78 +7805,104 @@ InitVM_process(void)
rb_define_module_function(rb_mProcess, "times", rb_proc_times, 0); rb_define_module_function(rb_mProcess, "times", rb_proc_times, 0);
#ifdef CLOCK_REALTIME #ifdef CLOCK_REALTIME
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME", CLOCKID2NUM(CLOCK_REALTIME)); rb_define_const(rb_mProcess, "CLOCK_REALTIME", CLOCKID2NUM(CLOCK_REALTIME));
#elif defined(RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME) #elif defined(RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME)
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME", RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME); rb_define_const(rb_mProcess, "CLOCK_REALTIME", RUBY_GETTIMEOFDAY_BASED_CLOCK_REALTIME);
#endif #endif
#ifdef CLOCK_MONOTONIC #ifdef CLOCK_MONOTONIC
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", CLOCKID2NUM(CLOCK_MONOTONIC)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", CLOCKID2NUM(CLOCK_MONOTONIC));
#elif defined(RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC) #elif defined(RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC)
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC", RUBY_MACH_ABSOLUTE_TIME_BASED_CLOCK_MONOTONIC);
#endif #endif
#ifdef CLOCK_PROCESS_CPUTIME_ID #ifdef CLOCK_PROCESS_CPUTIME_ID
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", CLOCKID2NUM(CLOCK_PROCESS_CPUTIME_ID)); rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", CLOCKID2NUM(CLOCK_PROCESS_CPUTIME_ID));
#elif defined(RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID) #elif defined(RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID)
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID); rb_define_const(rb_mProcess, "CLOCK_PROCESS_CPUTIME_ID", RUBY_GETRUSAGE_BASED_CLOCK_PROCESS_CPUTIME_ID);
#endif #endif
#ifdef CLOCK_THREAD_CPUTIME_ID #ifdef CLOCK_THREAD_CPUTIME_ID
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_THREAD_CPUTIME_ID", CLOCKID2NUM(CLOCK_THREAD_CPUTIME_ID)); rb_define_const(rb_mProcess, "CLOCK_THREAD_CPUTIME_ID", CLOCKID2NUM(CLOCK_THREAD_CPUTIME_ID));
#endif #endif
#ifdef CLOCK_VIRTUAL #ifdef CLOCK_VIRTUAL
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_VIRTUAL", CLOCKID2NUM(CLOCK_VIRTUAL)); rb_define_const(rb_mProcess, "CLOCK_VIRTUAL", CLOCKID2NUM(CLOCK_VIRTUAL));
#endif #endif
#ifdef CLOCK_PROF #ifdef CLOCK_PROF
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_PROF", CLOCKID2NUM(CLOCK_PROF)); rb_define_const(rb_mProcess, "CLOCK_PROF", CLOCKID2NUM(CLOCK_PROF));
#endif #endif
#ifdef CLOCK_REALTIME_FAST #ifdef CLOCK_REALTIME_FAST
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME_FAST", CLOCKID2NUM(CLOCK_REALTIME_FAST)); rb_define_const(rb_mProcess, "CLOCK_REALTIME_FAST", CLOCKID2NUM(CLOCK_REALTIME_FAST));
#endif #endif
#ifdef CLOCK_REALTIME_PRECISE #ifdef CLOCK_REALTIME_PRECISE
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME_PRECISE", CLOCKID2NUM(CLOCK_REALTIME_PRECISE)); rb_define_const(rb_mProcess, "CLOCK_REALTIME_PRECISE", CLOCKID2NUM(CLOCK_REALTIME_PRECISE));
#endif #endif
#ifdef CLOCK_REALTIME_COARSE #ifdef CLOCK_REALTIME_COARSE
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME_COARSE", CLOCKID2NUM(CLOCK_REALTIME_COARSE)); rb_define_const(rb_mProcess, "CLOCK_REALTIME_COARSE", CLOCKID2NUM(CLOCK_REALTIME_COARSE));
#endif #endif
#ifdef CLOCK_REALTIME_ALARM #ifdef CLOCK_REALTIME_ALARM
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_REALTIME_ALARM", CLOCKID2NUM(CLOCK_REALTIME_ALARM)); rb_define_const(rb_mProcess, "CLOCK_REALTIME_ALARM", CLOCKID2NUM(CLOCK_REALTIME_ALARM));
#endif #endif
#ifdef CLOCK_MONOTONIC_FAST #ifdef CLOCK_MONOTONIC_FAST
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_FAST", CLOCKID2NUM(CLOCK_MONOTONIC_FAST)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_FAST", CLOCKID2NUM(CLOCK_MONOTONIC_FAST));
#endif #endif
#ifdef CLOCK_MONOTONIC_PRECISE #ifdef CLOCK_MONOTONIC_PRECISE
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_PRECISE", CLOCKID2NUM(CLOCK_MONOTONIC_PRECISE)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_PRECISE", CLOCKID2NUM(CLOCK_MONOTONIC_PRECISE));
#endif #endif
#ifdef CLOCK_MONOTONIC_RAW #ifdef CLOCK_MONOTONIC_RAW
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_RAW", CLOCKID2NUM(CLOCK_MONOTONIC_RAW)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_RAW", CLOCKID2NUM(CLOCK_MONOTONIC_RAW));
#endif #endif
#ifdef CLOCK_MONOTONIC_RAW_APPROX #ifdef CLOCK_MONOTONIC_RAW_APPROX
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_RAW_APPROX", CLOCKID2NUM(CLOCK_MONOTONIC_RAW_APPROX)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_RAW_APPROX", CLOCKID2NUM(CLOCK_MONOTONIC_RAW_APPROX));
#endif #endif
#ifdef CLOCK_MONOTONIC_COARSE #ifdef CLOCK_MONOTONIC_COARSE
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_COARSE", CLOCKID2NUM(CLOCK_MONOTONIC_COARSE)); rb_define_const(rb_mProcess, "CLOCK_MONOTONIC_COARSE", CLOCKID2NUM(CLOCK_MONOTONIC_COARSE));
#endif #endif
#ifdef CLOCK_BOOTTIME #ifdef CLOCK_BOOTTIME
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_BOOTTIME", CLOCKID2NUM(CLOCK_BOOTTIME)); rb_define_const(rb_mProcess, "CLOCK_BOOTTIME", CLOCKID2NUM(CLOCK_BOOTTIME));
#endif #endif
#ifdef CLOCK_BOOTTIME_ALARM #ifdef CLOCK_BOOTTIME_ALARM
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_BOOTTIME_ALARM", CLOCKID2NUM(CLOCK_BOOTTIME_ALARM)); rb_define_const(rb_mProcess, "CLOCK_BOOTTIME_ALARM", CLOCKID2NUM(CLOCK_BOOTTIME_ALARM));
#endif #endif
#ifdef CLOCK_UPTIME #ifdef CLOCK_UPTIME
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_UPTIME", CLOCKID2NUM(CLOCK_UPTIME)); rb_define_const(rb_mProcess, "CLOCK_UPTIME", CLOCKID2NUM(CLOCK_UPTIME));
#endif #endif
#ifdef CLOCK_UPTIME_FAST #ifdef CLOCK_UPTIME_FAST
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_UPTIME_FAST", CLOCKID2NUM(CLOCK_UPTIME_FAST)); rb_define_const(rb_mProcess, "CLOCK_UPTIME_FAST", CLOCKID2NUM(CLOCK_UPTIME_FAST));
#endif #endif
#ifdef CLOCK_UPTIME_PRECISE #ifdef CLOCK_UPTIME_PRECISE
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_UPTIME_PRECISE", CLOCKID2NUM(CLOCK_UPTIME_PRECISE)); rb_define_const(rb_mProcess, "CLOCK_UPTIME_PRECISE", CLOCKID2NUM(CLOCK_UPTIME_PRECISE));
#endif #endif
#ifdef CLOCK_UPTIME_RAW #ifdef CLOCK_UPTIME_RAW
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_UPTIME_RAW", CLOCKID2NUM(CLOCK_UPTIME_RAW)); rb_define_const(rb_mProcess, "CLOCK_UPTIME_RAW", CLOCKID2NUM(CLOCK_UPTIME_RAW));
#endif #endif
#ifdef CLOCK_UPTIME_RAW_APPROX #ifdef CLOCK_UPTIME_RAW_APPROX
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_UPTIME_RAW_APPROX", CLOCKID2NUM(CLOCK_UPTIME_RAW_APPROX)); rb_define_const(rb_mProcess, "CLOCK_UPTIME_RAW_APPROX", CLOCKID2NUM(CLOCK_UPTIME_RAW_APPROX));
#endif #endif
#ifdef CLOCK_SECOND #ifdef CLOCK_SECOND
/* see Process.clock_gettime */
rb_define_const(rb_mProcess, "CLOCK_SECOND", CLOCKID2NUM(CLOCK_SECOND)); rb_define_const(rb_mProcess, "CLOCK_SECOND", CLOCKID2NUM(CLOCK_SECOND));
#endif #endif
rb_define_module_function(rb_mProcess, "clock_gettime", rb_clock_gettime, -1); rb_define_module_function(rb_mProcess, "clock_gettime", rb_clock_gettime, -1);