Files
Yukihiro "Matz" Matsumoto daaaafeff8 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>
2025-10-12 09:33:49 +09:00

28 lines
534 B
C

/*
** mruby/time.h - Time class
**
** See Copyright Notice in mruby.h
*/
#ifndef MRUBY_TIME_H
#define MRUBY_TIME_H
#include <mruby/common.h>
#include <time.h>
MRB_BEGIN_DECL
typedef enum mrb_timezone {
MRB_TIMEZONE_NONE = 0,
MRB_TIMEZONE_UTC = 1,
MRB_TIMEZONE_LOCAL = 2,
MRB_TIMEZONE_LAST = 3
} mrb_timezone;
MRB_API mrb_value mrb_time_at(mrb_state *mrb, time_t sec, time_t usec, mrb_timezone timezone);
MRB_API struct tm* mrb_time_get_tm(mrb_state *mrb, mrb_value time);
MRB_END_DECL
#endif /* MRUBY_TIME_H */