Commit f1f6caaf

f1f6caafc613Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 4 files · ~4 modified

Description

Add Process.clock_gettime, File.join, Process::CLOCK_MONOTONIC; fix system() sh invocation

  • Add Process.clock_gettime returning float (sp_process_clock_gettime using CLOCK_MONOTONIC)
  • Add Process::CLOCK_MONOTONIC/CLOCK_REALTIME constants to ConstantPathNode handler
  • Add File.join class method (sp_file_join helper joins paths with '/')
  • Fix system() single-arg form to use sh -c instead of direct execvp (matches Ruby semantics for string commands with spaces and shell metacharacters)

Fixes: bundle_io_sys

Co-Authored-By: Claude Sonnet 4.6 [email protected]

Details

Commit
f1f6caafc613
Parent
e8d0bd9c0ad2

lib/sp_runtime.hmodifiedView file

@@ -401,6 +401,16 @@
401401 #endif
402402 }
403403
404+static inline double sp_process_clock_gettime(void) {
405+#if defined(CLOCK_MONOTONIC)
406+ struct timespec ts;
407+ clock_gettime(CLOCK_MONOTONIC, &ts);
408+ return (double)ts.tv_sec + (double)ts.tv_nsec * 1e-9;
409+#else
410+ return 0.0;
411+#endif
412+}
413+
404414 /* ---- Encoding runtime ----
405415 Spinel currently assumes UTF-8 source and string data. Keep Encoding
406416 as a tiny value type so `__ENCODING__` and `String#encoding` can