Commit 7e0834e3
7e0834e3bf7aMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
Merge pull request #177 from mame/pr/process-clock-gettime
feat(codegen): Process.clock_gettime
Details
- Commit
- 7e0834e3bf7a
- Parent
- f5d42991c5b4
- Merge parent
- 649380a20848
spinel_codegen.rbmodifiedView file
@@ -3174,6 +3174,11 @@
31743174
if recv >= 031753175
if @nd_type[recv] == "ConstantReadNode"31763176
rcname = @nd_name[recv]3177+
if rcname == "Process"3178+
if mname == "clock_gettime"3179+
return "float"3180+
end3181+
end31773182
if rcname == "File"31783183
if mname == "read"31793184
return "string"@@ -19219,6 +19224,13 @@
1921919224
return "((mrb_int)time(NULL))"1922019225
end1922119226
end19227+
# Process.clock_gettime — assume CLOCK_MONOTONIC; the clock_id19228+
# arg is not modeled. Returns seconds as a float.19229+
if rcname == "Process"19230+
if mname == "clock_gettime"19231+
return "({ struct timespec _ts; clock_gettime(CLOCK_MONOTONIC, &_ts); (mrb_float)_ts.tv_sec + (mrb_float)_ts.tv_nsec / 1e9; })"19232+
end19233+
end1922219234
# ENV1922319235
if rcname == "ENV"1922419236
if mname == "[]"test/process_clock_gettime.rbaddedView file
Loading diff…