Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Macros | Typedefs | Enumerations | Functions | Variables
time.c File Reference
`#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

## Macro Definition Documentation

## ◆ _BSD_SOURCE

#define _BSD_SOURCE

Definition at line 13 of file time.c.

## ◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE

Definition at line 12 of file time.c.

## ◆ AREF [1/4]

#define AREF | ( |  | x | ) | rb_struct_aref(time, ID2SYM(id_##x))

## ◆ AREF [2/4]

#define AREF | ( |  | x | ) | rb_funcallv(time, id_##x, 0, 0)

## ◆ AREF [3/4]

#define AREF | ( |  | x | ) | rb_struct_aref(time, ID2SYM(id_##x))

## ◆ AREF [4/4]

#define AREF | ( |  | x | ) | rb_funcallv(time, id_##x, 0, 0)

## ◆ arg_range_check

#define arg_range_check | ( |  | v | ) |

Value:
(((v) < 0) ? \
rb_raise(rb_eArgError, "%s must not be negative", tstr) : \
(void)0)

## ◆ D28

#define D28

Value:
1,2,3,4,5,6,7,8,9, \
10,11,12,13,14,15,16,17,18,19, \
20,21,22,23,24,25,26,27,28

Definition at line 807 of file time.c.

## ◆ D29

#define D29

Value:
1,2,3,4,5,6,7,8,9, \
10,11,12,13,14,15,16,17,18,19, \
20,21,22,23,24,25,26,27,28,29

Definition at line 811 of file time.c.

## ◆ D30

#define D30

Value:
1,2,3,4,5,6,7,8,9, \
10,11,12,13,14,15,16,17,18,19, \
20,21,22,23,24,25,26,27,28,29,30

Definition at line 815 of file time.c.

## ◆ D31

#define D31

Value:
1,2,3,4,5,6,7,8,9, \
10,11,12,13,14,15,16,17,18,19, \
20,21,22,23,24,25,26,27,28,29,30,31

Definition at line 819 of file time.c.

## ◆ DEBUG_FIND_TIME_NUMGUESS_INC

#define DEBUG_FIND_TIME_NUMGUESS_INC

Definition at line 3126 of file time.c.

## ◆ DEBUG_REPORT_GUESSRANGE

#define DEBUG_REPORT_GUESSRANGE

Definition at line 3114 of file time.c.

## ◆ DIV

#define DIV | ( |  | n,
|  |  | d
| ) |  | ((n)<0 ? NDIV((n),(d)) : (n)/(d))

Definition at line 54 of file time.c.

## ◆ EXTRACT_TIME

#define EXTRACT_TIME | ( |  | ) |

Value:
do { \
t = v2w(rb_Integer(AREF(to_i))); \
} while (0)

## ◆ EXTRACT_VTM

#define EXTRACT_VTM | ( |  | ) |

Value:
do { \
VALUE subsecx; \
vtm->year = obj2vint(AREF(year)); \
vtm->mon = month_arg(AREF(mon)); \
vtm->mday = obj2ubits(AREF(mday), 5); \
vtm->hour = obj2ubits(AREF(hour), 5); \
vtm->min = obj2ubits(AREF(min), 6); \
vtm->sec = obj2subsecx(AREF(sec), &subsecx); \
vtm->isdst = RTEST(AREF(isdst)); \
vtm->utc_offset = Qnil; \
t = v2w(rb_Integer(AREF(to_i))); \
} while (0)

## ◆ FIXWINT_P

#define FIXWINT_P | ( |  | v | ) | FIXNUM_P(v)

Definition at line 226 of file time.c.

## ◆ FIXWV2WINT

#define FIXWV2WINT | ( |  | w | ) | FIX2LONG(WIDEVAL_GET(w))

Definition at line 231 of file time.c.

## ◆ FIXWV_MAX

#define FIXWV_MAX FIXNUM_MAX

Definition at line 227 of file time.c.

## ◆ FIXWV_MIN

#define FIXWV_MIN FIXNUM_MIN

Definition at line 228 of file time.c.

## ◆ FIXWV_P

#define FIXWV_P | ( |  | w | ) | FIXWINT_P(WIDEVAL_GET(w))

Definition at line 236 of file time.c.

## ◆ FIXWVABLE

#define FIXWVABLE | ( |  | i | ) | FIXABLE(i)

Definition at line 229 of file time.c.

## ◆ ge

#define ge | ( |  | x,
|  |  | y
| ) |  | (cmp((x),(y)) >= 0)

Definition at line 86 of file time.c.

## ◆ get_attr

#define get_attr | ( |  | attr,
|  |  | iffound
| ) |  |

Value:
attr = rb_attr_delete(str, id_##attr); \
if (!NIL_P(attr)) { \
iffound; \
}

## ◆ GetNewTimeval

#define GetNewTimeval | ( |  | obj,
|  |  | tobj
| ) |  | ((tobj) = get_new_timeval(obj))

Definition at line 1732 of file time.c.

## ◆ GetTimeval

#define GetTimeval | ( |  | obj,
|  |  | tobj
| ) |  | ((tobj) = get_timeval(obj))

Definition at line 1731 of file time.c.

## ◆ GMTIME

#define GMTIME | ( |  | tm,
|  |  | result
| ) |  | rb_gmtime_r((tm), &(result))

Definition at line 735 of file time.c.

## ◆ GMTIMEW

#define GMTIMEW | ( |  | w,
|  |  | v
| ) |  | (gmtimew(w, v) ? (void)0 : rb_raise(rb_eArgError, "gmtime error"))

Definition at line 1292 of file time.c.

## ◆ gt

#define gt | ( |  | x,
|  |  | y
| ) |  | (cmp((x),(y)) > 0)

Definition at line 84 of file time.c.

## ◆ GUESS

#define GUESS | ( |  | p | ) | (DEBUG_FIND_TIME_NUMGUESS_INC (utc_p ? gmtime_with_leapsecond((p), &result) : LOCALTIME((p), result)))

## ◆ id_div

#define id_div idDiv

Definition at line 43 of file time.c.

## ◆ id_divmod

#define id_divmod idDivmod

Definition at line 44 of file time.c.

## ◆ id_name

#define id_name idName

Definition at line 45 of file time.c.

## ◆ id_quo

#define id_quo idQuo

Definition at line 42 of file time.c.

## ◆ IsTimeval

#define IsTimeval | ( |  | obj | ) | rb_typeddata_is_kind_of((obj), &time_data_type)

Definition at line 1734 of file time.c.

## ◆ le

#define le | ( |  | x,
|  |  | y
| ) |  | (cmp((x),(y)) <= 0)

Definition at line 85 of file time.c.

## ◆ leap_year_v_p

#define leap_year_v_p | ( |  | y | ) | leap_year_p(NUM2LONG(modv((y), INT2FIX(400))))

Definition at line 670 of file time.c.

## ◆ LOCALTIME

#define LOCALTIME | ( |  | tm,
|  |  | result
| ) |  | rb_localtime_r((tm), &(result))

Definition at line 716 of file time.c.

## ◆ lt

#define lt | ( |  | x,
|  |  | y
| ) |  | (cmp((x),(y)) < 0)

Definition at line 83 of file time.c.

## ◆ M28

#define M28 | ( |  | m | ) |

Value:
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m)

Definition at line 776 of file time.c.

## ◆ M29

#define M29 | ( |  | m | ) |

Value:
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m)

Definition at line 780 of file time.c.

## ◆ M30

#define M30 | ( |  | m | ) |

Value:
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m)

Definition at line 784 of file time.c.

## ◆ M31

#define M31 | ( |  | m | ) |

Value:
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), \
(m),(m),(m),(m),(m),(m),(m),(m),(m),(m), (m)

Definition at line 788 of file time.c.

## ◆ MAKE_TM

#define MAKE_TM | ( |  | time,
|  |  | tobj
| ) |  |

Value:
do { \
if ((tobj)->tm_got == 0) { \
time_get_tm((time), (tobj)); \
} \
} while (0)

Definition at line 1754 of file time.c.

## ◆ MOD

#define MOD | ( |  | n,
|  |  | d
| ) |  | ((n)<0 ? NMOD((n),(d)) : (n)%(d))

Definition at line 55 of file time.c.

## ◆ MUL_OVERFLOW_FIXWV_P

#define MUL_OVERFLOW_FIXWV_P | ( |  | a,
|  |  | b
| ) |  | MUL_OVERFLOW_SIGNED_INTEGER_P(a, b, FIXWV_MIN, FIXWV_MAX)

Definition at line 237 of file time.c.

## ◆ mulquov

#define mulquov | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | (((y) == (z)) ? (x) : quov(mulv((x),(y)),(z)))

Definition at line 171 of file time.c.

## ◆ NDIV

#define NDIV | ( |  | x,
|  |  | y
| ) |  | (-(-((x)+1)/(y))-1)

Definition at line 52 of file time.c.

## ◆ ne

#define ne | ( |  | x,
|  |  | y
| ) |  | (!eq((x),(y)))

Definition at line 82 of file time.c.

## ◆ neg

#define neg | ( |  | x | ) | (subv(INT2FIX(0), (x)))

Definition at line 141 of file time.c.

## ◆ NEGFIXWVABLE

#define NEGFIXWVABLE | ( |  | wi | ) | ((wi) >= FIXWV_MIN)

Definition at line 235 of file time.c.

## ◆ NMOD

#define NMOD | ( |  | x,
|  |  | y
| ) |  | ((y)-(-((x)+1)%(y))-1)

Definition at line 53 of file time.c.

## ◆ POSFIXWVABLE

#define POSFIXWVABLE | ( |  | wi | ) | ((wi) < FIXWV_MAX+1)

Definition at line 234 of file time.c.

## ◆ rb_intern

#define rb_intern | ( |  | str | ) | rb_intern_const(str)

## ◆ strftimev

#define strftimev | ( |  | fmt,
|  |  | time,
|  |  | enc
| ) |  | strftime_cstr((fmt), rb_strlen_lit(fmt), (time), (enc))

Definition at line 4044 of file time.c.

## ◆ TIME_INIT_P

#define TIME_INIT_P | ( |  | tobj | ) | ((tobj)->tzmode != TIME_TZMODE_UNINITIALIZED)

Definition at line 1735 of file time.c.

## ◆ time_succ

#define time_succ rb_time_succ

Definition at line 4245 of file time.c.

## ◆ TIME_TZMODE_FIXOFF

#define TIME_TZMODE_FIXOFF 2

Definition at line 1721 of file time.c.

## ◆ TIME_TZMODE_LOCALTIME

#define TIME_TZMODE_LOCALTIME 0

Definition at line 1719 of file time.c.

## ◆ TIME_TZMODE_UNINITIALIZED

#define TIME_TZMODE_UNINITIALIZED 3

Definition at line 1722 of file time.c.

## ◆ TIME_TZMODE_UTC

#define TIME_TZMODE_UTC 1

Definition at line 1720 of file time.c.

## ◆ TIMET2WV

#define TIMET2WV | ( |  | t | ) | timet2wv(t)

Definition at line 620 of file time.c.

## ◆ TM_IS_TIME

#define TM_IS_TIME 1

Definition at line 49 of file time.c.

## ◆ TZMODE_COPY

#define TZMODE_COPY | ( |  | tobj1,
|  |  | tobj2
| ) |  |

Value:
((tobj1)->tzmode = (tobj2)->tzmode, \
(tobj1)->vtm.utc_offset = (tobj2)->vtm.utc_offset, \
(tobj1)->vtm.zone = (tobj2)->vtm.zone)

Definition at line 1748 of file time.c.

## ◆ TZMODE_FIXOFF_P

#define TZMODE_FIXOFF_P | ( |  | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_FIXOFF)

Definition at line 1743 of file time.c.

## ◆ TZMODE_LOCALTIME_P

#define TZMODE_LOCALTIME_P | ( |  | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_LOCALTIME)

Definition at line 1740 of file time.c.

## ◆ TZMODE_SET_FIXOFF

#define TZMODE_SET_FIXOFF | ( |  | tobj,
|  |  | off
| ) |  |

Value:
((tobj)->tzmode = TIME_TZMODE_FIXOFF, \
(tobj)->vtm.utc_offset = (off))

Definition at line 1744 of file time.c.

## ◆ TZMODE_SET_LOCALTIME

#define TZMODE_SET_LOCALTIME | ( |  | tobj | ) | ((tobj)->tzmode = TIME_TZMODE_LOCALTIME)

Definition at line 1741 of file time.c.

## ◆ TZMODE_SET_UTC

#define TZMODE_SET_UTC | ( |  | tobj | ) | ((tobj)->tzmode = TIME_TZMODE_UTC)

Definition at line 1738 of file time.c.

## ◆ TZMODE_UTC_P

#define TZMODE_UTC_P | ( |  | tobj | ) | ((tobj)->tzmode == TIME_TZMODE_UTC)

Definition at line 1737 of file time.c.

## ◆ UTC_ZONE

#define UTC_ZONE Qundef

Definition at line 46 of file time.c.

## ◆ UWIDEINT_MAX

#define UWIDEINT_MAX ULONG_MAX

Definition at line 223 of file time.c.

## ◆ validate_vtm_range

#define validate_vtm_range | ( |  | mem,
|  |  | b,
|  |  | e
| ) |  |

Value:
((vtm->mem < b || vtm->mem > e) ? \
rb_raise(rb_eArgError, #mem" out of range") : (void)0)

## ◆ VTM_ISDST_INITVAL

#define VTM_ISDST_INITVAL (3)

Definition at line 57 of file time.c.

## ◆ VTM_WDAY_INITVAL

#define VTM_WDAY_INITVAL (7)

Definition at line 56 of file time.c.

## ◆ wday_p

#define wday_p | ( |  | n | ) |

Value:
{\
struct time_object *tobj;\
GetTimeval(time, tobj);\
MAKE_TM(time, tobj);\
return (tobj->vtm.wday == (n)) ? Qtrue : Qfalse;\
}

Definition at line 4564 of file time.c.

## ◆ wge

#define wge | ( |  | x,
|  |  | y
| ) |  | (wcmp((x),(y)) >= 0)

Definition at line 359 of file time.c.

## ◆ wgt

#define wgt | ( |  | x,
|  |  | y
| ) |  | (wcmp((x),(y)) > 0)

Definition at line 357 of file time.c.

## ◆ WIDEINT_MAX

#define WIDEINT_MAX LONG_MAX

Definition at line 224 of file time.c.

## ◆ WIDEINT_MIN

#define WIDEINT_MIN LONG_MIN

Definition at line 225 of file time.c.

## ◆ WIDEVAL_GET

#define WIDEVAL_GET | ( |  | w | ) | (w)

Definition at line 250 of file time.c.

## ◆ WIDEVAL_WRAP

#define WIDEVAL_WRAP | ( |  | v | ) | (v)

Definition at line 249 of file time.c.

## ◆ WIDEVALUE_IS_WIDER

#define WIDEVALUE_IS_WIDER 0

Definition at line 222 of file time.c.

## ◆ WINT2FIXWV

#define WINT2FIXWV | ( |  | i | ) | WIDEVAL_WRAP(LONG2FIX(i))

Definition at line 230 of file time.c.

## ◆ WINT2WV

#define WINT2WV | ( |  | wi | ) | WIDEVAL_WRAP(LONG2NUM(wi))

Definition at line 264 of file time.c.

## ◆ wle

#define wle | ( |  | x,
|  |  | y
| ) |  | (wcmp((x),(y)) <= 0)

Definition at line 358 of file time.c.

## ◆ wlt

#define wlt | ( |  | x,
|  |  | y
| ) |  | (wcmp((x),(y)) < 0)

Definition at line 356 of file time.c.

## ◆ wmulquo

#define wmulquo | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | ((WIDEVAL_GET(y) == WIDEVAL_GET(z)) ? (x) : wquo(wmul((x),(y)),(z)))

Definition at line 415 of file time.c.

## ◆ wmulquoll

#define wmulquoll | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | (((y) == (z)) ? (x) : wquo(wmul((x),WINT2WV(y)),WINT2WV(z)))

Definition at line 416 of file time.c.

## ◆ wne

#define wne | ( |  | x,
|  |  | y
| ) |  | (!weq((x),(y)))

Definition at line 355 of file time.c.

## ◆ WV2TIMET

#define WV2TIMET | ( |  | t | ) | wv2timet(t)

Definition at line 643 of file time.c.

## Typedef Documentation

## ◆ SIGNED_WIDEVALUE

typedef SIGNED_VALUE SIGNED_WIDEVALUE

Definition at line 221 of file time.c.

## ◆ uwideint_t

typedef unsigned long uwideint_t

Definition at line 218 of file time.c.

## ◆ wideint_t

typedef long wideint_t

Definition at line 219 of file time.c.

## ◆ wideval_t

typedef WIDEVALUE wideval_t

Definition at line 248 of file time.c.

## ◆ WIDEVALUE

typedef VALUE WIDEVALUE

Definition at line 220 of file time.c.

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
TMOPT_IN |
TMOPT_MAX_ |

Definition at line 2711 of file time.c.

## ◆ anonymous enum

anonymous enum

Enumerator
base_dump_size |

Definition at line 5095 of file time.c.

## Function Documentation

## ◆ Init_Time()

void Init_Time | ( | void |  | ) |

Definition at line 5810 of file time.c.

## ◆ NORETURN()

NORETURN | ( | static void | invalid_utc_offsetvoid | ) |

## ◆ PACKED_STRUCT_UNALIGNED()

PACKED_STRUCT_UNALIGNED | ( | struct time_object { wideval_t timew;struct vtm vtm;unsigned int tzmode:3;unsigned int tm_got:1;} |  | ) |

## ◆ rb_time_interval()

struct timeval rb_time_interval | ( | VALUE | num | ) |

Definition at line 2669 of file time.c.

Referenced by rb_mutex_sleep().

## ◆ rb_time_nano_new()

VALUE rb_time_nano_new | ( | time_t | sec,
|  | long | nsec
| ) |  |

Definition at line 2519 of file time.c.

## ◆ rb_time_new()

VALUE rb_time_new | ( | time_t | sec,
|  | long | usec
| ) |  |

Definition at line 2492 of file time.c.

References NDIV, rb_eRangeError, rb_raise(), TIMET_MAX, and TIMET_MIN.

## ◆ rb_time_num_new()

VALUE rb_time_num_new | ( | VALUE | timev,
|  | VALUE | off
| ) |  |

Definition at line 2553 of file time.c.

References time().

## ◆ rb_time_succ()

VALUE rb_time_succ | ( | VALUE | time | ) |

Definition at line 4229 of file time.c.

References GetTimeval, rb_warn(), and time().

## ◆ rb_time_timespec()

struct timespec rb_time_timespec | ( | VALUE | time | ) |

Definition at line 2692 of file time.c.

References GetTimeval, IsTimeval, and time().

## ◆ rb_time_timespec_interval()

struct timespec rb_time_timespec_interval | ( | VALUE | num | ) |

Definition at line 2706 of file time.c.

## ◆ rb_time_timespec_new()

VALUE rb_time_timespec_new | ( | const struct timespec * | ts,
|  | int | offset
| ) |  |

Returns a time object with UTC/localtime/fixed offset.

offset is -86400 < fixoff < 86400 or INT_MAX (localtime) or INT_MAX-1 (utc)

Definition at line 2530 of file time.c.

References time().

## ◆ rb_time_timeval()

struct timeval rb_time_timeval | ( | VALUE | time | ) |

Definition at line 2675 of file time.c.

References GetTimeval, IsTimeval, and time().

Referenced by rb_thread_sleep().

## ◆ rb_time_utc_offset()

VALUE rb_time_utc_offset | ( | VALUE | time | ) |

Definition at line 4791 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, time(), and TZMODE_UTC_P.

## ◆ rb_time_zone_abbreviation()

VALUE rb_time_zone_abbreviation | ( | VALUE | zone,
|  | VALUE | time
| ) |  |

Definition at line 5650 of file time.c.

References NIL_P, and rb_check_string_type().

## ◆ rb_timespec_now()

void rb_timespec_now | ( | struct timespec * | ts | ) |

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.

## ◆ ruby_marshal_read_long()

long ruby_marshal_read_long | ( | const char ** | buf,
|  | long | len
| ) |  |

Definition at line 1266 of file marshal.c.

References arg, buf, len, memset(), rb_setup_fake_str(), and src.

## ◆ ruby_marshal_write_long()

int ruby_marshal_write_long | ( | long | x,
|  | char * | buf
| ) |  |

Definition at line 307 of file marshal.c.

References buf, char, i, int, and RSHIFT.

## ◆ ruby_reset_leap_second_info()

void ruby_reset_leap_second_info | ( | void |  | ) |

Definition at line 1193 of file time.c.

## Variable Documentation

## ◆ ruby_tz_uptodate_p

bool ruby_tz_uptodate_p

Definition at line 674 of file time.c.

void
void
Definition: rb_mjit_min_header-2.7.0.h:13273
time
time_t time(time_t *_timer)
rb_eArgError
VALUE rb_eArgError
Definition: error.c:923
TIME_TZMODE_FIXOFF
#define TIME_TZMODE_FIXOFF
Definition: time.c:1721
rb_Integer
VALUE rb_Integer(VALUE)
Equivalent to Kernel#Integer in Ruby.
Definition: object.c:3106
Qfalse
#define Qfalse
Definition: ruby.h:467
v
int VALUE v
Definition: rb_mjit_min_header-2.7.0.h:12332
rb_raise
void rb_raise(VALUE exc, const char *fmt,...)
Definition: error.c:2669
n
const char size_t n
Definition: rb_mjit_min_header-2.7.0.h:5456
str
char str[HTML_ESCAPE_MAX_LEN+1]
Definition: escape.c:18
NIL_P
#define NIL_P(v)
Definition: ruby.h:482
Qtrue
#define Qtrue
Definition: ruby.h:468
rb_attr_delete
VALUE rb_attr_delete(VALUE, ID)
Definition: variable.c:1126
Qnil
#define Qnil
Definition: ruby.h:469
RTEST
#define RTEST(v)
Definition: ruby.h:481
AREF
#define AREF(x)