Ruby
2.7.1p83(2020-03-31revisiona0c7c23c9cec0d0ffcba012279cd652d28ad5bf3)
|
#include "ruby/encoding.h"
#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 | id_quo idQuo |
#define | id_div idDiv |
#define | id_divmod idDivmod |
#define | id_name idName |
#define | UTC_ZONE Qundef |
#define | TM_IS_TIME 1 |
#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 | 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) rb_localtime_r((tm), &(result)) |
#define | GMTIME(tm, result) rb_gmtime_r((tm), &(result)) |
#define | M28(m) |
#define | M29(m) |
#define | M30(m) |
#define | M31(m) |
#define | D28 |
#define | D29 |
#define | D30 |
#define | D31 |
#define | GMTIMEW(w, v) (gmtimew(w, v) ? (void)0 : rb_raise(rb_eArgError, "gmtime error")) |
#define | TIME_TZMODE_LOCALTIME 0 |
#define | TIME_TZMODE_UTC 1 |
#define | TIME_TZMODE_FIXOFF 2 |
#define | TIME_TZMODE_UNINITIALIZED 3 |
#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)->tzmode != TIME_TZMODE_UNINITIALIZED) |
#define | TZMODE_UTC_P(tobj) ((tobj)->tzmode == TIME_TZMODE_UTC) |
#define | TZMODE_SET_UTC(tobj) ((tobj)->tzmode = TIME_TZMODE_UTC) |
#define | TZMODE_LOCALTIME_P(tobj) ((tobj)->tzmode == TIME_TZMODE_LOCALTIME) |
#define | TZMODE_SET_LOCALTIME(tobj) ((tobj)->tzmode = TIME_TZMODE_LOCALTIME) |
#define | TZMODE_FIXOFF_P(tobj) ((tobj)->tzmode == TIME_TZMODE_FIXOFF) |
#define | TZMODE_SET_FIXOFF(tobj, off) |
#define | TZMODE_COPY(tobj1, tobj2) |
#define | MAKE_TM(time, tobj) |
#define | EXTRACT_TIME() |
#define | AREF(x) rb_struct_aref(time, ID2SYM(id_##x)) |
#define | AREF(x) rb_funcallv(time, id_##x, 0, 0) |
#define | EXTRACT_VTM() |
#define | AREF(x) rb_struct_aref(time, ID2SYM(id_##x)) |
#define | AREF(x) rb_funcallv(time, id_##x, 0, 0) |
#define | arg_range_check(v) |
#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 |
Enumerations | |
enum | { TMOPT_IN, TMOPT_MAX_ } |
enum | { base_dump_size = 8 } |
Functions | |
void | ruby_reset_leap_second_info (void) |
PACKED_STRUCT_UNALIGNED (struct time_object { wideval_t timew;struct vtm vtm;unsigned int tzmode:3;unsigned int tm_got:1;}) | |
void | rb_timespec_now (struct timespec *ts) |
NORETURN (static void invalid_utc_offset(void)) | |
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) |
struct timespec | rb_time_timespec_interval (VALUE num) |
VALUE | rb_time_succ (VALUE time) |
VALUE | rb_time_utc_offset (VALUE time) |
int | ruby_marshal_write_long (long x, char *buf) |
long | ruby_marshal_read_long (const char **buf, long len) |
VALUE | rb_time_zone_abbreviation (VALUE zone, VALUE time) |
void | Init_Time (void) |
Variables | |
VALUE | rb_cTime |
bool | ruby_tz_uptodate_p |
#define AREF | ( | x | ) | rb_struct_aref(time, ID2SYM(id_##x)) |
#define AREF | ( | x | ) | rb_funcallv(time, id_##x, 0, 0) |
#define AREF | ( | x | ) | rb_struct_aref(time, ID2SYM(id_##x)) |
#define AREF | ( | x | ) | rb_funcallv(time, id_##x, 0, 0) |
#define arg_range_check | ( | v | ) |
#define D28 |
#define D29 |
#define D30 |
#define D31 |
#define EXTRACT_TIME | ( | ) |
#define EXTRACT_VTM | ( | ) |
#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 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) |
#define M28 | ( | m | ) |
#define M29 | ( | m | ) |
#define M30 | ( | m | ) |
#define M31 | ( | m | ) |
#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 rb_intern | ( | str | ) | rb_intern_const(str) |
#define TIME_INIT_P | ( | tobj | ) | ((tobj)->tzmode != TIME_TZMODE_UNINITIALIZED) |
#define time_succ rb_time_succ |
#define TZMODE_COPY | ( | tobj1, | |
tobj2 | |||
) |
#define TZMODE_FIXOFF_P | ( | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_FIXOFF) |
#define TZMODE_LOCALTIME_P | ( | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_LOCALTIME) |
#define TZMODE_SET_FIXOFF | ( | tobj, | |
off | |||
) |
#define TZMODE_SET_LOCALTIME | ( | tobj | ) | ((tobj)->tzmode = TIME_TZMODE_LOCALTIME) |
#define TZMODE_SET_UTC | ( | tobj | ) | ((tobj)->tzmode = TIME_TZMODE_UTC) |
#define TZMODE_UTC_P | ( | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_UTC) |
#define validate_vtm_range | ( | mem, | |
b, | |||
e | |||
) |
#define wday_p | ( | n | ) |
#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 |
NORETURN | ( | static void | invalid_utc_offsetvoid | ) |
PACKED_STRUCT_UNALIGNED | ( | struct time_object { wideval_t timew;struct vtm vtm;unsigned int tzmode:3;unsigned int tm_got:1;} | ) |
Definition at line 2669 of file time.c.
Referenced by rb_mutex_sleep().
Definition at line 2492 of file time.c.
References NDIV, rb_eRangeError, rb_raise(), TIMET_MAX, and TIMET_MIN.
Definition at line 4229 of file time.c.
References GetTimeval, rb_warn(), and time().
Definition at line 2692 of file time.c.
References GetTimeval, IsTimeval, and time().
Definition at line 2675 of file time.c.
References GetTimeval, IsTimeval, and time().
Referenced by rb_thread_sleep().
Definition at line 4791 of file time.c.
References GetTimeval, INT2FIX, MAKE_TM, time(), and TZMODE_UTC_P.
Definition at line 5650 of file time.c.
References NIL_P, and rb_check_string_type().
Definition at line 1873 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.