mruby-time: add mrb_time_get_tm() API for accessing struct tm

add public api function to retrieve struct tm from time object.
this enables other gems to access time components for formatting
while maintaining encapsulation of internal mrb_time structure.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Yukihiro "Matz" Matsumoto
2025-10-12 08:24:44 +09:00
parent 572c674c2b
commit daaaafeff8
2 changed files with 9 additions and 0 deletions
+8
View File
@@ -753,6 +753,14 @@ time_get_ptr(mrb_state *mrb, mrb_value time)
return tm;
}
MRB_API struct tm*
mrb_time_get_tm(mrb_state *mrb, mrb_value time)
{
struct mrb_time *tm = time_get_ptr(mrb, time);
time_update_datetime(mrb, tm, FALSE);
return &tm->datetime;
}
/*
* call-seq:
* time == other_time -> true or false