Project

General

Profile

Actions

Feature #11558

closed

Time related C APIs

Added by naruse (Yui NARUSE) over 8 years ago. Updated about 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-dev:<unknown>]

Description

Time関連のC APIを追加して欲しいです。
具体的には以下のようなものが欲しいです。

struct timespecとoffsetを取って、Timeを返してください。
VALUE rb_time_timespec_new(const struct timespec *ts, int offset);
趣旨としては、[秒, ナノ秒, offset]からTimeを作って欲しいと言うことです。
(rb_time_num_new(Rational, offset)とかだと手間かかる上に遅い)

現在時刻をstruct timespecで欲しいです。
void timespec_now(struct timespec *ts);

既存の非公開APIを公開してください。
struct tm * localtime_with_gmtoff_zone(const time_t *t, struct tm *result, long *gmtoff, const char **zone);
time_t timegm_noleapsecond(struct tm *tm);
void tm_add_offset(struct tm *tm, long diff);

https://github.com/nurse/strptime/blob/v0.1.1/ext/strptime/ruby_time.c

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0