mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
daaaafeff8
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>
28 lines
534 B
C
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 */
|