|
Ruby
2.5.0dev(2017-10-22revision60238)
|
#include "internal.h"#include <sys/types.h>#include <time.h>#include <errno.h>#include <float.h>#include <math.h>#include "timev.h"#include "id.h"Go to the source code of this file.
Macros | |
| #define | _DEFAULT_SOURCE |
| #define | _BSD_SOURCE |
| #define | NDIV(x, y) (-(-((x)+1)/(y))-1) |
| #define | NMOD(x, y) ((y)-(-((x)+1)%(y))-1) |
| #define | DIV(n, d) ((n)<0 ? NDIV((n),(d)) : (n)/(d)) |
| #define | MOD(n, d) ((n)<0 ? NMOD((n),(d)) : (n)%(d)) |
| #define | VTM_WDAY_INITVAL (7) |
| #define | VTM_ISDST_INITVAL (3) |
| #define | TO_GMT_INITVAL (3) |
| #define | ne(x, y) (!eq((x),(y))) |
| #define | lt(x, y) (cmp((x),(y)) < 0) |
| #define | gt(x, y) (cmp((x),(y)) > 0) |
| #define | le(x, y) (cmp((x),(y)) <= 0) |
| #define | ge(x, y) (cmp((x),(y)) >= 0) |
| #define | neg(x) (subv(INT2FIX(0), (x))) |
| #define | mulquov(x, y, z) (((y) == (z)) ? (x) : quov(mulv((x),(y)),(z))) |
| #define | WIDEVALUE_IS_WIDER 0 |
| #define | UWIDEINT_MAX ULONG_MAX |
| #define | WIDEINT_MAX LONG_MAX |
| #define | WIDEINT_MIN LONG_MIN |
| #define | FIXWINT_P(v) FIXNUM_P(v) |
| #define | FIXWV_MAX FIXNUM_MAX |
| #define | FIXWV_MIN FIXNUM_MIN |
| #define | FIXWVABLE(i) FIXABLE(i) |
| #define | WINT2FIXWV(i) WIDEVAL_WRAP(LONG2FIX(i)) |
| #define | FIXWV2WINT(w) FIX2LONG(WIDEVAL_GET(w)) |
| #define | POSFIXWVABLE(wi) ((wi) < FIXWV_MAX+1) |
| #define | NEGFIXWVABLE(wi) ((wi) >= FIXWV_MIN) |
| #define | FIXWV_P(w) FIXWINT_P(WIDEVAL_GET(w)) |
| #define | MUL_OVERFLOW_FIXWV_P(a, b) MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXWV_MIN, FIXWV_MAX) |
| #define | WIDEVAL_WRAP(v) (v) |
| #define | WIDEVAL_GET(w) (w) |
| #define | WINT2WV(wi) WIDEVAL_WRAP(LONG2NUM(wi)) |
| #define | wne(x, y) (!weq((x),(y))) |
| #define | wlt(x, y) (wcmp((x),(y)) < 0) |
| #define | wgt(x, y) (wcmp((x),(y)) > 0) |
| #define | wle(x, y) (wcmp((x),(y)) <= 0) |
| #define | wge(x, y) (wcmp((x),(y)) >= 0) |
| #define | wmulquo(x, y, z) ((WIDEVAL_GET(y) == WIDEVAL_GET(z)) ? (x) : wquo(wmul((x),(y)),(z))) |
| #define | wmulquoll(x, y, z) (((y) == (z)) ? (x) : wquo(wmul((x),WINT2WV(y)),WINT2WV(z))) |
| #define | TIMET2WV(t) timet2wv(t) |
| #define | WV2TIMET(t) wv2timet(t) |
| #define | leap_year_v_p(y) leap_year_p(NUM2LONG(modv((y), INT2FIX(400)))) |
| #define | LOCALTIME(tm, result) (tzset(),rb_localtime_r((tm), &(result))) |
| #define | GMTIME(tm, result) rb_gmtime_r((tm), &(result)) |
| #define | GetTimeval(obj, tobj) ((tobj) = get_timeval(obj)) |
| #define | GetNewTimeval(obj, tobj) ((tobj) = get_new_timeval(obj)) |
| #define | IsTimeval(obj) rb_typeddata_is_kind_of((obj), &time_data_type) |
| #define | TIME_INIT_P(tobj) ((tobj)->gmt != TO_GMT_INITVAL) |
| #define | TIME_UTC_P(tobj) ((tobj)->gmt == 1) |
| #define | TIME_SET_UTC(tobj) ((tobj)->gmt = 1) |
| #define | TIME_LOCALTIME_P(tobj) ((tobj)->gmt == 0) |
| #define | TIME_SET_LOCALTIME(tobj) ((tobj)->gmt = 0) |
| #define | TIME_FIXOFF_P(tobj) ((tobj)->gmt == 2) |
| #define | TIME_SET_FIXOFF(tobj, off) |
| #define | TIME_COPY_GMT(tobj1, tobj2) |
| #define | MAKE_TM(time, tobj) |
| #define | validate_vtm_range(mem, b, e) |
| #define | DEBUG_REPORT_GUESSRANGE |
| #define | DEBUG_FIND_TIME_NUMGUESS_INC |
| #define | GUESS(p) (DEBUG_FIND_TIME_NUMGUESS_INC (utc_p ? gmtime_with_leapsecond((p), &result) : LOCALTIME((p), result))) |
| #define | strftimev(fmt, time, enc) strftime_cstr((fmt), rb_strlen_lit(fmt), (time), (enc)) |
| #define | time_succ rb_time_succ |
| #define | wday_p(n) |
| #define | get_attr(attr, iffound) |
| #define | rb_intern(str) rb_intern_const(str) |
Typedefs | |
| typedef unsigned long | uwideint_t |
| typedef long | wideint_t |
| typedef VALUE | WIDEVALUE |
| typedef SIGNED_VALUE | SIGNED_WIDEVALUE |
| typedef WIDEVALUE | wideval_t |
Functions | |
| PACKED_STRUCT_UNALIGNED (struct time_object { wideval_t timew;struct vtm vtm;uint8_t gmt:3;uint8_t tm_got:1;}) | |
| void | rb_timespec_now (struct timespec *ts) |
| VALUE | rb_time_new (time_t sec, long usec) |
| VALUE | rb_time_nano_new (time_t sec, long nsec) |
| VALUE | rb_time_timespec_new (const struct timespec *ts, int offset) |
| Returns a time object with UTC/localtime/fixed offset. More... | |
| VALUE | rb_time_num_new (VALUE timev, VALUE off) |
| struct timeval | rb_time_interval (VALUE num) |
| struct timeval | rb_time_timeval (VALUE time) |
| struct timespec | rb_time_timespec (VALUE time) |
| VALUE | rb_time_succ (VALUE time) |
| void | Init_Time (void) |
Variables | |
| VALUE | rb_cTime |
| #define FIXWV2WINT | ( | w | ) | FIX2LONG(WIDEVAL_GET(w)) |
| #define FIXWV_MAX FIXNUM_MAX |
| #define FIXWV_MIN FIXNUM_MIN |
| #define FIXWV_P | ( | w | ) | FIXWINT_P(WIDEVAL_GET(w)) |
| #define get_attr | ( | attr, | |
| iffound | |||
| ) |
| #define GetNewTimeval | ( | obj, | |
| tobj | |||
| ) | ((tobj) = get_new_timeval(obj)) |
| #define GetTimeval | ( | obj, | |
| tobj | |||
| ) | ((tobj) = get_timeval(obj)) |
Definition at line 1607 of file time.c.
Referenced by rb_time_succ(), rb_time_timespec(), and rb_time_timeval().
| #define GUESS | ( | p | ) | (DEBUG_FIND_TIME_NUMGUESS_INC (utc_p ? gmtime_with_leapsecond((p), &result) : LOCALTIME((p), result))) |
| #define IsTimeval | ( | obj | ) | rb_typeddata_is_kind_of((obj), &time_data_type) |
Definition at line 1610 of file time.c.
Referenced by rb_time_timespec(), and rb_time_timeval().
| #define LOCALTIME | ( | tm, | |
| result | |||
| ) | (tzset(),rb_localtime_r((tm), &(result))) |
| #define MAKE_TM | ( | time, | |
| tobj | |||
| ) |
| #define MUL_OVERFLOW_FIXWV_P | ( | a, | |
| b | |||
| ) | MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXWV_MIN, FIXWV_MAX) |
| #define mulquov | ( | x, | |
| y, | |||
| z | |||
| ) | (((y) == (z)) ? (x) : quov(mulv((x),(y)),(z))) |
| #define NDIV | ( | x, | |
| y | |||
| ) | (-(-((x)+1)/(y))-1) |
Definition at line 41 of file time.c.
Referenced by rb_time_new().
| #define ne | ( | x, | |
| y | |||
| ) | (!eq((x),(y))) |
| #define neg | ( | x | ) | (subv(INT2FIX(0), (x))) |
Definition at line 131 of file time.c.
Referenced by asinh(), atanh(), rb_fix2str(), rb_int2big(), and rb_math_sqrt().
| #define rb_intern | ( | str | ) | rb_intern_const(str) |
Referenced by Init_Time().
| #define strftimev | ( | fmt, | |
| time, | |||
| enc | |||
| ) | strftime_cstr((fmt), rb_strlen_lit(fmt), (time), (enc)) |
| #define TIME_COPY_GMT | ( | tobj1, | |
| tobj2 | |||
| ) |
| #define TIME_INIT_P | ( | tobj | ) | ((tobj)->gmt != TO_GMT_INITVAL) |
| #define TIME_SET_FIXOFF | ( | tobj, | |
| off | |||
| ) |
| #define time_succ rb_time_succ |
| #define validate_vtm_range | ( | mem, | |
| b, | |||
| e | |||
| ) |
| #define wday_p | ( | n | ) |
| #define WINT2FIXWV | ( | i | ) | WIDEVAL_WRAP(LONG2FIX(i)) |
| #define WINT2WV | ( | wi | ) | WIDEVAL_WRAP(LONG2NUM(wi)) |
| #define wmulquo | ( | x, | |
| y, | |||
| z | |||
| ) | ((WIDEVAL_GET(y) == WIDEVAL_GET(z)) ? (x) : wquo(wmul((x),(y)),(z))) |
| typedef SIGNED_VALUE SIGNED_WIDEVALUE |
| typedef unsigned long uwideint_t |
| PACKED_STRUCT_UNALIGNED | ( | struct time_object { wideval_t timew;struct vtm vtm;uint8_t gmt:3;uint8_t tm_got:1;} | ) |
Definition at line 2299 of file time.c.
Referenced by rb_mutex_sleep().
| VALUE rb_time_new | ( | time_t | sec, |
| long | usec | ||
| ) |
Definition at line 2143 of file time.c.
References NDIV, rb_eRangeError, and rb_raise().
Definition at line 3718 of file time.c.
References GetTimeval, and rb_warn().
Definition at line 2322 of file time.c.
References GetTimeval, and IsTimeval.
Definition at line 2305 of file time.c.
References GetTimeval, and IsTimeval.
Referenced by rb_thread_sleep().
| void rb_timespec_now | ( | struct timespec * | ts | ) |
Definition at line 1749 of file time.c.
References clock_gettime(), CLOCK_REALTIME, gettimeofday(), rb_sys_fail(), timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, and timeval::tv_usec.
1.8.13