Ruby 2.0.0p353(2013-11-22revision43784)

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions | Variables
time.c File Reference
`#include "ruby/ruby.h"`
`#include <sys/types.h>`
`#include <time.h>`
`#include <errno.h>`
`#include "ruby/encoding.h"`
`#include "internal.h"`
`#include <float.h>`
`#include <math.h>`
`#include "timev.h"`
Include dependency graph for time.c:

Go to the source code of this file.

## Data Structures
struct | time_object

## Macros
#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 | 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 | div(x, y) (rb_funcall((x), id_div, 1, (y)))
#define | neg(x) (sub(INT2FIX(0), (x)))
#define | lshift(x, y) (rb_funcall((x), id_lshift, 1, (y)))
#define | mulquo(x, y, z) (((y) == (z)) ? (x) : quo(mul((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 | 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 | TYPEOF_TIMEVAL_TV_SEC time_t
#define | TYPEOF_TIMEVAL_TV_USEC long
#define | TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0))
#define | TIMET_MIN (~(time_t)0 <= 0 ? (time_t)(((unsigned_time_t)1) << (sizeof(time_t) * CHAR_BIT - 1)) : (time_t)0)
#define | TIMET2WV(t) timet2wv(t)
#define | WV2TIMET(t) wv2timet(t)
#define | leap_year_v_p(y) leap_year_p(NUM2LONG(mod((y), INT2FIX(400))))
#define | LOCALTIME(tm, result) (tzset(),rb_localtime_r2((tm), &(result)))
#define | GMTIME(tm, result) rb_gmtime_r2((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 != -1)
#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 | 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 | time_succ rb_time_succ
#define | wday_p(n)
#define | SMALLBUF 100
#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
typedef unsigned long | unsigned_time_t

## Functions
static int | eq (VALUE x, VALUE y)
static int | cmp (VALUE x, VALUE y)
static VALUE | add (VALUE x, VALUE y)
static VALUE | sub (VALUE x, VALUE y)
static int | long_mul (long x, long y, long *z)
static VALUE | mul (VALUE x, VALUE y)
static VALUE | mod (VALUE x, VALUE y)
static VALUE | quo (VALUE x, VALUE y)
static void | divmodv (VALUE n, VALUE d, VALUE *q, VALUE *r)
static VALUE | w2v (wideval_t w)
static wideval_t | v2w (VALUE v)
static int | weq (wideval_t wx, wideval_t wy)
static int | wcmp (wideval_t wx, wideval_t wy)
static wideval_t | wadd (wideval_t wx, wideval_t wy)
static wideval_t | wsub (wideval_t wx, wideval_t wy)
static int | wi_mul (wideint_t x, wideint_t y, wideint_t *z)
static wideval_t | wmul (wideval_t wx, wideval_t wy)
static wideval_t | wquo (wideval_t wx, wideval_t wy)
static void | wdivmod (wideval_t wn, wideval_t wd, wideval_t *wq, wideval_t *wr)
static void | wmuldivmod (wideval_t wx, wideval_t wy, wideval_t wz, wideval_t *wq, wideval_t *wr)
static wideval_t | wdiv (wideval_t wx, wideval_t wy)
static wideval_t | wmod (wideval_t wx, wideval_t wy)
static VALUE | num_exact (VALUE v)
static wideval_t | rb_time_magnify (wideval_t w)
static wideval_t | rb_time_unmagnify (wideval_t w)
static VALUE | rb_time_unmagnify_to_float (wideval_t w)
static void | split_second (wideval_t timew, wideval_t *timew_p, VALUE *subsecx_p)
static wideval_t | timet2wv (time_t t)
static time_t | wv2timet (wideval_t w)
static VALUE time_utc_offset | _ ((VALUE))
static int | obj2int (VALUE obj)
static VALUE | obj2vint (VALUE obj)
static int | month_arg (VALUE arg)
static VALUE | validate_utc_offset (VALUE utc_offset)
static VALUE | validate_zone_name (VALUE zone_name)
static void | validate_vtm (struct vtm *vtm)
static int | obj2subsecx (VALUE obj, VALUE *subsecx)
static VALUE | time_gmtime (VALUE)
static VALUE | time_localtime (VALUE)
static VALUE | time_fixoff (VALUE)
static time_t | timegm_noleapsecond (struct tm *tm)
static int | tmcmp (struct tm *a, struct tm *b)
static int | vtmcmp (struct vtm *a, struct vtm *b)
static const char * | find_time_t (struct tm *tptr, int utc_p, time_t *tp)
static struct vtm * | localtimew (wideval_t timew, struct vtm *result)
static int | leap_year_p (long y)
static struct tm * | rb_gmtime_r (const time_t *tp, struct tm *result)
static struct tm * | rb_localtime_r (const time_t *tp, struct tm *result)
static struct tm * | rb_localtime_r2 (const time_t *t, struct tm *result)
static struct tm * | rb_gmtime_r2 (const time_t *t, struct tm *result)
static int | calc_tm_yday (long tm_year, int tm_mon, int tm_mday)
static wideval_t | timegmw_noleapsecond (struct vtm *vtm)
static int | zone_str_update (st_data_t *key, st_data_t *value, st_data_t arg, int existing)
static const char * | zone_str (const char *s)
static void | gmtimew_noleapsecond (wideval_t timew, struct vtm *vtm)
static struct tm * | gmtime_with_leapsecond (const time_t *timep, struct tm *result)
static void | init_leap_second_info (void)
static wideval_t | timegmw (struct vtm *vtm)
static struct vtm * | gmtimew (wideval_t timew, struct vtm *result)
static struct tm * | localtime_with_gmtoff_zone (const time_t *t, struct tm *result, long *gmtoff, const char **zone)
static int | calc_wday (int year, int month, int day)
static VALUE | guess_local_offset (struct vtm *vtm_utc, int *isdst_ret, const char **zone_ret)
static VALUE | small_vtm_sub (struct vtm *vtm1, struct vtm *vtm2)
static wideval_t | timelocalw (struct vtm *vtm)
static int | timew_out_of_timet_range (wideval_t timew)
static VALUE | time_get_tm (VALUE, struct time_object *)
static void | time_mark (void *ptr)
static void | time_free (void *tobj)
static size_t | time_memsize (const void *tobj)
static VALUE | time_s_alloc (VALUE klass)
static struct time_object * | get_timeval (VALUE obj)
static struct time_object * | get_new_timeval (VALUE obj)
static void | time_modify (VALUE time)
static wideval_t | timespec2timew (struct timespec *ts)
static struct timespec | timew2timespec (wideval_t timew)
static struct timespec * | timew2timespec_exact (wideval_t timew, struct timespec *ts)
static VALUE | time_init_0 (VALUE time)
static VALUE | time_set_utc_offset (VALUE time, VALUE off)
static void | vtm_add_offset (struct vtm *vtm, VALUE off)
static VALUE | utc_offset_arg (VALUE arg)
static VALUE | time_init_1 (int argc, VALUE *argv, VALUE time)
static VALUE | time_init (int argc, VALUE *argv, VALUE time)
static void | time_overflow_p (time_t *secp, long *nsecp)
static wideval_t | nsec2timew (time_t sec, long nsec)
static VALUE | time_new_timew (VALUE klass, wideval_t timew)
VALUE | rb_time_new (time_t sec, long usec)
VALUE | rb_time_nano_new (time_t sec, long nsec)
VALUE | rb_time_num_new (VALUE timev, VALUE off)
static struct timespec | time_timespec (VALUE num, int interval)
static struct timeval | time_timeval (VALUE num, int interval)
struct timeval | rb_time_interval (VALUE num)
struct timeval | rb_time_timeval (VALUE time)
struct timespec | rb_time_timespec (VALUE time)
static VALUE | time_s_now (VALUE klass)
static VALUE | time_s_at (int argc, VALUE *argv, VALUE klass)
static long | usec2subsecx (VALUE obj)
static void | time_arg (int argc, VALUE *argv, struct vtm *vtm)
static VALUE | time_utc_or_local (int argc, VALUE *argv, int utc_p, VALUE klass)
static VALUE | time_s_mkutc (int argc, VALUE *argv, VALUE klass)
static VALUE | time_s_mktime (int argc, VALUE *argv, VALUE klass)
static VALUE | time_to_i (VALUE time)
static VALUE | time_to_f (VALUE time)
static VALUE | time_to_r (VALUE time)
static VALUE | time_usec (VALUE time)
static VALUE | time_nsec (VALUE time)
static VALUE | time_subsec (VALUE time)
static VALUE | time_cmp (VALUE time1, VALUE time2)
static VALUE | time_eql (VALUE time1, VALUE time2)
static VALUE | time_utc_p (VALUE time)
static VALUE | time_hash (VALUE time)
static VALUE | time_init_copy (VALUE copy, VALUE time)
static VALUE | time_dup (VALUE time)
static VALUE | time_localtime_m (int argc, VALUE *argv, VALUE time)
static VALUE | time_getlocaltime (int argc, VALUE *argv, VALUE time)
static VALUE | time_getgmtime (VALUE time)
static VALUE | strftimev (const char *fmt, VALUE time, rb_encoding *enc)
static VALUE | time_asctime (VALUE time)
static VALUE | time_to_s (VALUE time)
static VALUE | time_add (struct time_object *tobj, VALUE offset, int sign)
static VALUE | time_plus (VALUE time1, VALUE time2)
static VALUE | time_minus (VALUE time1, VALUE time2)
VALUE | rb_time_succ (VALUE time)
static VALUE | time_round (int argc, VALUE *argv, VALUE time)
static VALUE | time_sec (VALUE time)
static VALUE | time_min (VALUE time)
static VALUE | time_hour (VALUE time)
static VALUE | time_mday (VALUE time)
static VALUE | time_mon (VALUE time)
static VALUE | time_year (VALUE time)
static VALUE | time_wday (VALUE time)
static VALUE | time_sunday (VALUE time)
static VALUE | time_monday (VALUE time)
static VALUE | time_tuesday (VALUE time)
static VALUE | time_wednesday (VALUE time)
static VALUE | time_thursday (VALUE time)
static VALUE | time_friday (VALUE time)
static VALUE | time_saturday (VALUE time)
static VALUE | time_yday (VALUE time)
static VALUE | time_isdst (VALUE time)
static VALUE | time_zone (VALUE time)
static VALUE | time_utc_offset (VALUE time)
static VALUE | time_to_a (VALUE time)
static size_t | rb_strftime_alloc (char **buf, VALUE formatv, const char *format, rb_encoding *enc, struct vtm *vtm, wideval_t timew, int gmt)
static VALUE | time_strftime (VALUE time, VALUE format)
static VALUE | time_mdump (VALUE time)
static VALUE | time_dump (int argc, VALUE *argv, VALUE time)
static VALUE | time_mload (VALUE time, VALUE str)
static VALUE | time_load (VALUE klass, VALUE str)
void | Init_Time (void)

## Variables
static ID | id_divmod
static ID | id_mul
static ID | id_submicro
static ID | id_nano_num
static ID | id_nano_den
static ID | id_offset
static ID | id_zone
static ID | id_eq
static ID | id_ne
static ID | id_quo
static ID | id_div
static ID | id_cmp
static ID | id_lshift
VALUE | rb_cTime
static const int | common_year_yday_offset []
static const int | leap_year_yday_offset []
static const int | common_year_days_in_month []
static const int | leap_year_days_in_month []
static st_table * | zone_table
static long | this_year = 0
static time_t | known_leap_seconds_limit
static int | number_of_leap_seconds_known
static int | compat_common_month_table [12][7]
static int | compat_leap_month_table [7]
static const rb_data_type_t | time_data_type
static const char | months [][4]

## Macro Definition Documentation

#define DEBUG_FIND_TIME_NUMGUESS_INC

Definition at line 2823 of file time.c.

#define DEBUG_REPORT_GUESSRANGE

Definition at line 2811 of file time.c.

Referenced by find_time_t().

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

Definition at line 41 of file time.c.

Referenced by timegm_noleapsecond(), and timegmw_noleapsecond().

#define div | ( |  | x,
|  |  | y
| ) |  | (rb_funcall((x), id_div, 1, (y)))

Definition at line 160 of file time.c.

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

Definition at line 246 of file time.c.

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

Definition at line 251 of file time.c.

Referenced by rb_time_magnify(), rb_time_unmagnify(), rb_time_unmagnify_to_float(), timew_out_of_timet_range(), w2v(), wadd(), wcmp(), wdivmod(), wmul(), wquo(), wsub(), and wv2timet().

#define FIXWV_MAX FIXNUM_MAX

Definition at line 247 of file time.c.

Referenced by timet2wv().

#define FIXWV_MIN FIXNUM_MIN

Definition at line 248 of file time.c.

Referenced by timet2wv().

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

Definition at line 256 of file time.c.

Referenced by rb_time_magnify(), rb_time_unmagnify(), rb_time_unmagnify_to_float(), time_mark(), timew_out_of_timet_range(), w2v(), wadd(), wcmp(), wdivmod(), weq(), wmul(), wquo(), wsub(), and wv2timet().

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

Definition at line 249 of file time.c.

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

Definition at line 70 of file time.c.

Referenced by iseq_specialized_instruction(), validate_utc_offset(), and validate_vtm().

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

Value:
attr = rb_attr_get(str, id_##attr); \
if (!NIL_P(attr)) { \
data = id_##attr; \
iffound; \
st_delete(rb_generic_ivar_table(str), &data, 0); \
}
data
VALUE data
Definition: tcltklib.c:3368
NIL_P
NIL_P(eventloop_thread)
Definition: tcltklib.c:4068
st_delete
int st_delete(st_table *, st_data_t *, st_data_t *)
str
static VALUE char * str
Definition: tcltklib.c:3547
rb_attr_get
VALUE rb_attr_get(VALUE, ID)
Definition: variable.c:1122
rb_generic_ivar_table
struct st_table * rb_generic_ivar_table(VALUE)
Definition: variable.c:904
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186

Referenced by time_mload().

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

Definition at line 1834 of file time.c.

Referenced by time_init_0(), time_init_1(), time_init_copy(), and time_mload().

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

Definition at line 1833 of file time.c.

Referenced by rb_time_succ(), rb_time_timespec(), rb_time_timeval(), strftimev(), time_add(), time_cmp(), time_eql(), time_fixoff(), time_gmtime(), time_hash(), time_hour(), time_init_copy(), time_isdst(), time_localtime(), time_mday(), time_mdump(), time_min(), time_minus(), time_mon(), time_nsec(), time_plus(), time_round(), time_s_at(), time_sec(), time_set_utc_offset(), time_strftime(), time_subsec(), time_to_a(), time_to_f(), time_to_i(), time_to_r(), time_to_s(), time_usec(), time_utc_offset(), time_utc_p(), time_wday(), time_yday(), time_year(), and time_zone().

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

Definition at line 935 of file time.c.

Referenced by gmtime_with_leapsecond(), and localtime_with_gmtoff_zone().

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

Definition at line 68 of file time.c.

Referenced by iseq_specialized_instruction(), and timegmw().

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

Referenced by find_time_t().

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

Definition at line 1836 of file time.c.

Referenced by rb_time_timespec(), rb_time_timeval(), time_cmp(), time_eql(), time_minus(), time_plus(), and time_s_at().

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

Definition at line 69 of file time.c.

Referenced by iseq_specialized_instruction(), pack_pack(), syserr_initialize(), timew_out_of_timet_range(), validate_utc_offset(), and vtm_add_offset().

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

Definition at line 869 of file time.c.

Referenced by vtm_add_offset().

#define LOCALTIME | ( |  | tm,
|  |  | result
| ) |  | (tzset(),rb_localtime_r2((tm), &(result)))

Definition at line 918 of file time.c.

Referenced by find_time_t(), gmtime_with_leapsecond(), and localtime_with_gmtoff_zone().

#define lshift | ( |  | x,
|  |  | y
| ) |  | (rb_funcall((x), id_lshift, 1, (y)))

Definition at line 172 of file time.c.

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

Definition at line 67 of file time.c.

Referenced by filetime_to_timeval(), guess_local_offset(), iseq_specialized_instruction(), small_vtm_sub(), time_round(), timelocalw(), timew_out_of_timet_range(), validate_vtm(), vtm_add_offset(), and vtmcmp().

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

Value:
do { \
if ((tobj)->tm_got == 0) { \
time_get_tm((time), (tobj)); \
} \
} while (0)
time_get_tm
static VALUE time_get_tm(VALUE, struct time_object *)
Definition: time.c:3702
if
if(RB_TYPE_P(r, T_FLOAT))
Definition: bigdecimal.c:1186
time
VALUE time
Definition: tcltklib.c:1866

Definition at line 1857 of file time.c.

Referenced by strftimev(), time_hour(), time_isdst(), time_mday(), time_min(), time_mon(), time_sec(), time_strftime(), time_to_a(), time_utc_offset(), time_wday(), time_yday(), time_year(), and time_zone().

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

Definition at line 42 of file time.c.

Referenced by calc_tm_yday().

#define mulquo | ( |  | x,
|  |  | y,
|  |  | z
| ) |  | (((y) == (z)) ? (x) : quo(mul((x),(y)),(z)))

Definition at line 196 of file time.c.

Referenced by time_mdump(), time_mload(), timew2timespec(), timew2timespec_exact(), and usec2subsecx().

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

Definition at line 39 of file time.c.

Referenced by time_overflow_p().

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

Definition at line 66 of file time.c.

Referenced by add_ensure_range(), small_vtm_sub(), VpAlloc(), VpCtoV(), VpDtoV(), and vtmcmp().

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

Definition at line 171 of file time.c.

Referenced by asinh(), atanh(), int_pow(), int_round_0(), nurat_round(), parse_char_class(), parse_enclose(), rb_fix2str(), rb_int2big(), time_init_1(), and vtm_add_offset().

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

Definition at line 255 of file time.c.

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

Definition at line 40 of file time.c.

Referenced by time_overflow_p().

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

Definition at line 254 of file time.c.

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

#define SMALLBUF 100

Definition at line 4361 of file time.c.

Referenced by rb_strftime_alloc(), strftimev(), and time_strftime().

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

Value:
((tobj1)->gmt = (tobj2)->gmt, \
(tobj1)->vtm.utc_offset = (tobj2)->vtm.utc_offset, \
(tobj1)->vtm.zone = (tobj2)->vtm.zone)
vtm::zone
const char * zone
Definition: timev.h:16
vtm
Definition: timev.h:4
vtm::utc_offset
VALUE utc_offset
Definition: timev.h:12

Definition at line 1851 of file time.c.

Referenced by rb_time_succ(), and time_s_at().

#define TIME_FIXOFF_P | ( |  | tobj | ) | ((tobj)->gmt == 2)

Definition at line 1845 of file time.c.

Referenced by time_add(), time_fixoff(), and time_get_tm().

#define TIME_INIT_P | ( |  | tobj | ) | ((tobj)->gmt != -1)

Definition at line 1837 of file time.c.

Referenced by get_new_timeval(), and get_timeval().

#define TIME_LOCALTIME_P | ( |  | tobj | ) | ((tobj)->gmt == 0)

Definition at line 1842 of file time.c.

Referenced by time_localtime().

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

Value:
((tobj)->gmt = 2, \
(tobj)->vtm.utc_offset = (off), \
(tobj)->vtm.zone = NULL)
NULL
#define NULL
Definition: _sdbm.c:103

Definition at line 1846 of file time.c.

Referenced by time_add(), time_fixoff(), and time_set_utc_offset().

#define TIME_SET_LOCALTIME | ( |  | tobj | ) | ((tobj)->gmt = 0)

Definition at line 1843 of file time.c.

Referenced by time_localtime().

#define TIME_SET_UTC | ( |  | tobj | ) | ((tobj)->gmt = 1)

Definition at line 1840 of file time.c.

Referenced by time_add(), time_gmtime(), and time_mload().

#define time_succ rb_time_succ

Definition at line 3858 of file time.c.

Referenced by Init_Time().

#define TIME_UTC_P | ( |  | tobj | ) | ((tobj)->gmt == 1)

Definition at line 1839 of file time.c.

Referenced by strftimev(), time_add(), time_get_tm(), time_gmtime(), time_mdump(), time_strftime(), time_to_s(), time_utc_offset(), time_utc_p(), and time_zone().

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

Definition at line 821 of file time.c.

Referenced by gmtimew(), init_leap_second_info(), time_mload(), timegmw(), timelocalw(), and timespec2timew().

#define TIMET_MAX (~(time_t)0 <= 0 ? (time_t)((~(unsigned_time_t)0) >> 1) : (time_t)(~(unsigned_time_t)0))

Definition at line 741 of file time.c.

Referenced by find_time_t(), init_leap_second_info(), rb_time_new(), timew_out_of_timet_range(), and wv2timet().

#define TIMET_MIN (~(time_t)0 <= 0 ? (time_t)(((unsigned_time_t)1) << (sizeof(time_t) * CHAR_BIT - 1)) : (time_t)0)

Definition at line 742 of file time.c.

Referenced by find_time_t(), timet2wv(), timew_out_of_timet_range(), and wv2timet().

#define TYPEOF_TIMEVAL_TV_SEC time_t

Definition at line 721 of file time.c.

Referenced by rb_time_timeval(), and time_timeval().

#define TYPEOF_TIMEVAL_TV_USEC long

Definition at line 727 of file time.c.

Referenced by rb_time_timeval(), and time_timeval().

#define UWIDEINT_MAX ULONG_MAX

Definition at line 243 of file time.c.

Referenced by wi_mul().

#define wday_p | ( |  | n | ) |

Value:
{\
struct time_object *tobj;\
GetTimeval(time, tobj);\
MAKE_TM(time, tobj);\
return (tobj->vtm.wday == (n)) ? Qtrue : Qfalse;\
}
n
ssize_t n
Definition: bigdecimal.c:5655
GetTimeval
#define GetTimeval(obj, tobj)
Definition: time.c:1833
return
return
Definition: bigdecimal.c:5800
Qtrue
return Qtrue
Definition: tcltklib.c:9610
time_object
Definition: time.c:1826
Qfalse
return Qfalse
Definition: tcltklib.c:6779
MAKE_TM
#define MAKE_TM(time, tobj)
Definition: time.c:1857
time
VALUE time
Definition: tcltklib.c:1866

Definition at line 4090 of file time.c.

Referenced by time_friday(), time_monday(), time_saturday(), time_sunday(), time_thursday(), time_tuesday(), and time_wednesday().

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

Definition at line 444 of file time.c.

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

Definition at line 442 of file time.c.

#define WIDEINT_MAX LONG_MAX

Definition at line 244 of file time.c.

Referenced by wi_mul().

#define WIDEINT_MIN LONG_MIN

Definition at line 245 of file time.c.

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

Definition at line 269 of file time.c.

Referenced by w2v(), weq(), and wmuldivmod().

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

Definition at line 268 of file time.c.

Referenced by v2w().

#define WIDEVALUE_IS_WIDER 0

Definition at line 242 of file time.c.

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

Definition at line 250 of file time.c.

Referenced by gmtimew(), gmtimew_noleapsecond(), rb_time_magnify(), rb_time_succ(), rb_time_unmagnify(), split_second(), time_init_0(), time_init_1(), time_mload(), time_s_alloc(), time_subsec(), time_to_i(), time_usec(), timegmw_noleapsecond(), timelocalw(), timet2wv(), wdivmod(), and wmuldivmod().

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

Definition at line 283 of file time.c.

Referenced by gmtimew(), rb_time_magnify(), time_nsec(), time_usec(), timegmw(), timespec2timew(), wadd(), wdivmod(), wmul(), wquo(), and wsub().

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

Definition at line 443 of file time.c.

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

Definition at line 441 of file time.c.

Referenced by gmtimew(), and timegmw().

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

Definition at line 566 of file time.c.

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

Definition at line 567 of file time.c.

Referenced by time_mload(), time_nsec(), time_s_at(), and timespec2timew().

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

Definition at line 440 of file time.c.

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

Definition at line 844 of file time.c.

Referenced by gmtimew(), localtimew(), timew2timespec(), and timew2timespec_exact().

## Typedef Documentation

typedef SIGNED_VALUE SIGNED_WIDEVALUE

Definition at line 241 of file time.c.

typedef unsigned long unsigned_time_t

Definition at line 732 of file time.c.

typedef unsigned long uwideint_t

Definition at line 238 of file time.c.

typedef long wideint_t

Definition at line 239 of file time.c.

typedef WIDEVALUE wideval_t

Definition at line 267 of file time.c.

typedef VALUE WIDEVALUE

Definition at line 240 of file time.c.

## Function Documentation

static VALUE time_utc_offset _ | ( | (VALUE) |  | ) |
| static

static VALUE add | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 73 of file time.c.

References FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, LONG2NUM, rb_big_plus(), rb_funcall(), RB_TYPE_P, and T_BIGNUM.

Referenced by gmtimew_noleapsecond(), time_mdump(), time_mload(), timegmw_noleapsecond(), timew_out_of_timet_range(), and vtm_add_offset().

static int calc_tm_yday | ( | long | tm_year,
|  | int | tm_mon,
|  | int | tm_mday
| ) |  |
| static

Definition at line 977 of file time.c.

References int, leap_year_p(), and MOD.

Referenced by find_time_t(), and timegmw_noleapsecond().

static int calc_wday | ( | int | year,
|  | int | month,
|  | int | day
| ) |  |
| static

Definition at line 1494 of file time.c.

References a, and m.

Referenced by guess_local_offset().

static int cmp | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 54 of file time.c.

References FIXNUM_P, id_cmp, rb_cmpint(), and rb_funcall().

static void divmodv | ( | VALUE | n,
|  | VALUE | d,
|  | VALUE * | q,
|  | VALUE * | r
| ) |  |
| static

Definition at line 199 of file time.c.

References ary, id_divmod, NIL_P(), rb_ary_entry(), rb_check_array_type(), rb_eTypeError, rb_funcall(), rb_obj_classname(), rb_raise(), and tmp.

Referenced by gmtimew_noleapsecond(), obj2subsecx(), time_mdump(), timegmw_noleapsecond(), and vtm_add_offset().

static int eq | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 45 of file time.c.

References FIXNUM_P, id_eq, rb_funcall(), and RTEST.

Referenced by init_env(), iseq_specialized_instruction(), and weq().

static const char * find_time_t | ( | struct tm * | tptr,
|  | int | utc_p,
|  | time_t * | tp
| ) |  |
| static

Definition at line 2827 of file time.c.

References calc_tm_yday(), d, DEBUG_REPORT_GUESSRANGE, GUESS, leap_year_p(), LOCALTIME, NULL, status, timegm_noleapsecond(), TIMET_MAX, TIMET_MIN, and tmcmp().

Referenced by timegmw(), and timelocalw().

static struct time_object* get_new_timeval | ( | VALUE | obj | ) |
| static

Definition at line 1919 of file time.c.

References CLASS_OF, PRIsVALUE, rb_eTypeError, rb_raise(), time_data_type, TIME_INIT_P, and TypedData_Get_Struct.

static struct time_object* get_timeval | ( | VALUE | obj | ) |
| static

Definition at line 1908 of file time.c.

References CLASS_OF, PRIsVALUE, rb_eTypeError, rb_raise(), time_data_type, TIME_INIT_P, and TypedData_Get_Struct.

static struct tm* gmtime_with_leapsecond | ( | const time_t * | timep,
|  | struct tm * | result
| ) |  |
| static

Definition at line 1165 of file time.c.

References common_year_days_in_month, GMTIME, int, leap_year_p(), LOCALTIME, NULL, result, and t.

Referenced by gmtimew(), and init_leap_second_info().

static struct vtm* gmtimew | ( | wideval_t | timew,
|  | struct vtm * | result
| ) |  |
| static

Definition at line 1370 of file time.c.

References gmtime_with_leapsecond(), gmtimew_noleapsecond(), vtm::hour, init_leap_second_info(), INT2FIX, vtm::isdst, LONG2NUM, vtm::mday, vtm::min, vtm::mon, NULL, rb_time_magnify(), result, vtm::sec, split_second(), vtm::subsecx, t, TIMET2WV, vtm::utc_offset, vtm::wday, WINT2FIXWV, WINT2WV, wlt, wsub(), WV2TIMET, vtm::yday, vtm::year, and vtm::zone.

Referenced by localtimew(), time_fixoff(), time_gmtime(), and time_mdump().

static void gmtimew_noleapsecond | ( | wideval_t | timew,
|  | struct vtm * | vtm
| ) |  |
| static

Definition at line 1059 of file time.c.

References add(), common_year_yday_offset, divmodv(), vtm::hour, i, INT2FIX, INT2NUM, vtm::isdst, leap_year_p(), leap_year_yday_offset, vtm::mday, vtm::min, mod(), vtm::mon, mul(), n, NUM2INT, vtm::sec, split_second(), vtm::subsecx, vtm::utc_offset, v, w2v(), vtm::wday, wdivmod(), WINT2FIXWV, vtm::yday, vtm::year, and vtm::zone.

Referenced by gmtimew().

static VALUE guess_local_offset | ( | struct vtm * | vtm_utc,
|  | int * | isdst_ret,
|  | const char ** | zone_ret
| ) |  |
| static

Definition at line 1508 of file time.c.

References calc_wday(), INT2FIX, vtm::isdst, leap_year_p(), localtime_with_gmtoff_zone(), LONG2FIX, lt, mod(), vtm::mon, NULL, NUM2INT, rb_time_unmagnify(), t, time, timegmw(), w2v(), vtm::wday, vtm::year, and vtm::zone.

Referenced by localtimew().

static void init_leap_second_info | ( | void |  | ) |
| static

Definition at line 1293 of file time.c.

References gmtime_with_leapsecond(), vtm::hour, INT2FIX, LONG2NUM, vtm::mday, vtm::min, vtm::mon, NULL, NUM2INT, rb_time_unmagnify(), result, vtm::sec, vtm::subsecx, time, timegmw_noleapsecond(), TIMET2WV, TIMET_MAX, vtm::utc_offset, w2v(), wsub(), and vtm::year.

Referenced by gmtimew(), and timegmw().

void Init_Time | ( | void |  | ) |

Definition at line 4995 of file time.c.

References id_cmp, id_div, id_divmod, id_eq, id_lshift, id_mul, id_nano_den, id_nano_num, id_ne, id_offset, id_quo, id_submicro, id_zone, NULL, rb_cObject, rb_define_alloc_func(), rb_define_class(), rb_define_method(), rb_define_private_method(), rb_define_singleton_method(), rb_define_virtual_variable(), rb_include_module(), rb_intern, rb_mComparable, rb_singleton_class(), time_asctime(), time_cmp(), time_dump(), time_eql(), time_friday(), time_getgmtime(), time_getlocaltime(), time_gmtime(), time_hash(), time_hour(), time_init(), time_init_copy(), time_isdst(), time_load(), time_localtime_m(), time_mday(), time_mdump(), time_min(), time_minus(), time_mload(), time_mon(), time_monday(), time_nsec(), time_plus(), time_round(), time_s_alloc(), time_s_at(), time_s_mktime(), time_s_mkutc(), time_s_now(), time_saturday(), time_sec(), time_strftime(), time_subsec(), time_succ, time_sunday(), time_thursday(), time_to_a(), time_to_f(), time_to_i(), time_to_r(), time_to_s(), time_tuesday(), time_usec(), time_utc_offset(), time_utc_p(), time_wday(), time_wednesday(), time_yday(), time_year(), and time_zone().

static int leap_year_p | ( | long | y | ) |
| static

Definition at line 2774 of file time.c.

Referenced by calc_tm_yday(), find_time_t(), gmtime_with_leapsecond(), gmtimew_noleapsecond(), guess_local_offset(), and timegm_noleapsecond().

static struct tm * localtime_with_gmtoff_zone | ( | const time_t * | t,
|  | struct tm * | result,
|  | long * | gmtoff,
|  | const char ** | zone
| ) |  |
| static

Definition at line 1694 of file time.c.

References buf, GMTIME, LOCALTIME, NULL, result, and zone_str().

Referenced by guess_local_offset(), and localtimew().

static struct vtm * localtimew | ( | wideval_t | timew,
|  | struct vtm * | result
| ) |  |
| static

Definition at line 1778 of file time.c.

References gmtimew(), guess_local_offset(), vtm::hour, vtm::isdst, localtime_with_gmtoff_zone(), LONG2NUM, vtm::mday, vtm::min, vtm::mon, NULL, rb_time_magnify(), result, vtm::sec, split_second(), vtm::subsecx, t, timew_out_of_timet_range(), vtm::utc_offset, v2w(), wadd(), vtm::wday, WV2TIMET, vtm::yday, vtm::year, and vtm::zone.

Referenced by time_localtime(), and timelocalw().

static int long_mul | ( | long | x,
|  | long | y,
|  | long * | z
| ) |  |
| static

Definition at line 98 of file time.c.

References a, b, c, LONG_MAX, and s.

Referenced by mul().

static VALUE mod | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 163 of file time.c.

References rb_big_modulo(), rb_funcall(), T_BIGNUM, and TYPE.

Referenced by gmtimew_noleapsecond(), guess_local_offset(), time_mdump(), and time_round().

static int month_arg | ( | VALUE | arg | ) |
| static

Definition at line 2648 of file time.c.

References c, i, NIL_P(), obj2int(), rb_check_string_type(), RSTRING_LEN, RSTRING_PTR, s, and STRCASECMP.

Referenced by time_arg(), and time_init_1().

static VALUE mul | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 141 of file time.c.

References FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, LONG2NUM, long_mul(), rb_big_mul(), rb_funcall(), RB_TYPE_P, and T_BIGNUM.

Referenced by gmtimew_noleapsecond(), time_round(), timegmw_noleapsecond(), and timew_out_of_timet_range().

static wideval_t nsec2timew | ( | time_t | sec,
|  | long | nsec
| ) |  |
| static

Definition at line 2341 of file time.c.

References time_overflow_p(), timespec2timew(), timespec::tv_nsec, and timespec::tv_sec.

Referenced by rb_time_nano_new(), and rb_time_new().

static VALUE num_exact | ( | VALUE | v | ) |
| static

Definition at line 666 of file time.c.

References INT2FIX, NIL_P(), NULL, Qundef, rb_check_funcall(), rb_check_to_integer(), rb_eTypeError, rb_intern, rb_obj_classname(), rb_raise(), rb_respond_to(), RRATIONAL, t, T_BIGNUM, T_FIXNUM, T_NIL, T_RATIONAL, T_STRING, tmp, TYPE, and v.

Referenced by obj2subsecx(), time_add(), time_mload(), time_s_at(), time_set_utc_offset(), usec2subsecx(), and utc_offset_arg().

static int obj2int | ( | VALUE | obj | ) |
| static

Definition at line 2599 of file time.c.

References FALSE, NUM2INT, rb_str_to_inum(), RB_TYPE_P, and T_STRING.

Referenced by month_arg(), time_arg(), and time_init_1().

static int obj2subsecx | ( | VALUE | obj,
|  | VALUE * | subsecx
| ) |  |
| static

Definition at line 2622 of file time.c.

References divmodv(), FALSE, INT2FIX, NUM2INT, num_exact(), rb_str_to_inum(), rb_time_magnify(), RB_TYPE_P, T_STRING, v2w(), and w2v().

Referenced by time_arg(), and time_init_1().

static VALUE obj2vint | ( | VALUE | obj | ) |
| static

Definition at line 2609 of file time.c.

References FALSE, obj, rb_str_to_inum(), rb_to_int(), RB_TYPE_P, and T_STRING.

Referenced by time_arg(), and time_init_1().

static VALUE quo | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 175 of file time.c.

References a, b, c, FIX2LONG, FIXNUM_P, id_quo, INT2FIX, LONG2NUM, rb_funcall(), rb_num_zerodiv(), RB_TYPE_P, ret, RRATIONAL, and T_RATIONAL.

Referenced by rb_time_unmagnify_to_float(), time_mload(), time_round(), and time_subsec().

static struct tm* rb_gmtime_r | ( | const time_t * | tp,
|  | struct tm * | result
| ) |  |
| static

Definition at line 876 of file time.c.

References t.

Referenced by rb_gmtime_r2().

static struct tm* rb_gmtime_r2 | ( | const time_t * | t,
|  | struct tm * | result
| ) |  |
| static

Definition at line 922 of file time.c.

References NULL, rb_gmtime_r(), and result.

static struct tm* rb_localtime_r | ( | const time_t * | tp,
|  | struct tm * | result
| ) |  |
| static

Definition at line 884 of file time.c.

References t.

Referenced by rb_localtime_r2().

static struct tm* rb_localtime_r2 | ( | const time_t * | t,
|  | struct tm * | result
| ) |  |
| static

Definition at line 893 of file time.c.

References NULL, rb_localtime_r(), and result.

static size_t rb_strftime_alloc | ( | char ** | buf,
|  | VALUE | formatv,
|  | const char * | format,
|  | rb_encoding * | enc,
|  | struct vtm * | vtm,
|  | wideval_t | timew,
|  | int | gmt
| ) |  |
| static

Definition at line 4363 of file time.c.

References errno, len, NIL_P(), Qnil, rb_strftime(), rb_strftime_timespec(), rb_sys_fail(), rb_sys_fail_str(), rb_time_unmagnify(), size, SMALLBUF, strlen(), timew2timespec_exact(), w2v(), xfree, and xmalloc.

Referenced by strftimev(), and time_strftime().

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

Definition at line 2492 of file time.c.

References time_timeval(), and TRUE.

Referenced by io_wait_readable(), io_wait_writable(), rb_f_select(), rb_f_sleep(), and rb_mutex_sleep().

static wideval_t rb_time_magnify | ( | wideval_t | w | ) |
| static

Definition at line 745 of file time.c.

References FIXWV2WINT, FIXWV_P, TIME_SCALE, wi_mul(), WINT2FIXWV, WINT2WV, and wmul().

Referenced by gmtimew(), localtimew(), obj2subsecx(), rb_time_num_new(), time_add(), time_mload(), time_s_at(), timegmw(), timegmw_noleapsecond(), timelocalw(), timespec2timew(), and vtm_add_offset().

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

Definition at line 2390 of file time.c.

References nsec2timew(), and time_new_timew().

Referenced by stat_atime(), stat_ctime(), and stat_mtime().

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

Definition at line 2364 of file time.c.

References nsec2timew(), rb_eRangeError, rb_raise(), time_new_timew(), TIMET_MAX, and time_object::timew.

Referenced by rb_gzfile_mtime().

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

Definition at line 2396 of file time.c.

References NIL_P(), rb_time_magnify(), time, time_new_timew(), time_set_utc_offset(), utc_offset_arg(), v2w(), and validate_utc_offset().

VALUE rb_time_succ | ( | VALUE | time | ) |

Definition at line 3845 of file time.c.

References GetTimeval, rb_warn(), time, TIME_COPY_GMT, time_new_timew(), TIME_SCALE, time_object::timew, wadd(), and WINT2FIXWV.

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

Definition at line 2515 of file time.c.

References FALSE, GetTimeval, IsTimeval, t, time, time_timespec(), and timew2timespec().

Referenced by rb_file_s_utime().

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

Definition at line 2498 of file time.c.

References FALSE, GetTimeval, IsTimeval, t, time, time_timeval(), timew2timespec(), timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, timeval::tv_usec, TYPEOF_TIMEVAL_TV_SEC, and TYPEOF_TIMEVAL_TV_USEC.

Referenced by rb_thread_sleep().

static wideval_t rb_time_unmagnify | ( | wideval_t | w | ) |
| static

Definition at line 756 of file time.c.

References a, b, c, FIXWV2WINT, FIXWV_P, TIME_SCALE, WINT2FIXWV, and wquo().

Referenced by guess_local_offset(), init_leap_second_info(), rb_strftime_alloc(), time_round(), and time_to_r().

static VALUE rb_time_unmagnify_to_float | ( | wideval_t | w | ) |
| static

Definition at line 773 of file time.c.

References a, b, c, DBL2NUM, FIXWV2WINT, FIXWV_P, quo(), TIME_SCALE, v, and w2v().

Referenced by time_minus(), and time_to_f().

static VALUE small_vtm_sub | ( | struct vtm * | vtm1,
|  | struct vtm * | vtm2
| ) |  |
| static

Definition at line 1594 of file time.c.

References vtm::hour, INT2FIX, lt, vtm::mday, vtm::min, vtm::mon, ne, vtm::sec, and vtm::year.

Referenced by timelocalw().

static void split_second | ( | wideval_t | timew,
|  | wideval_t * | timew_p,
|  | VALUE * | subsecx_p
| ) |  |
| static

Definition at line 794 of file time.c.

References q, r, TIME_SCALE, w2v(), wdivmod(), and WINT2FIXWV.

Referenced by gmtimew(), gmtimew_noleapsecond(), localtimew(), timew2timespec(), and timew2timespec_exact().

static VALUE strftimev | ( | const char * | fmt,
|  | VALUE | time,
|  | rb_encoding * | enc
| ) |  |
| static

Definition at line 4410 of file time.c.

References buf, GetTimeval, len, MAKE_TM, Qnil, rb_enc_str_new(), rb_strftime_alloc(), SMALLBUF, str, TIME_UTC_P, time_object::timew, time_object::vtm, and xfree.

Referenced by time_asctime(), and time_to_s().

static VALUE sub | ( | VALUE | x,
|  | VALUE | y
| ) |  |
| static

Definition at line 85 of file time.c.

References FIX2LONG, FIXABLE, FIXNUM_P, LONG2FIX, LONG2NUM, rb_big_minus(), rb_funcall(), RB_TYPE_P, and T_BIGNUM.

Referenced by time_round(), timegmw_noleapsecond(), timelocalw(), and vtm_add_offset().

static VALUE time_add | ( | struct time_object * | tobj,
|  | VALUE | offset,
|  | int | sign
| ) |  |
| static

Definition at line 3756 of file time.c.

References GetTimeval, num_exact(), rb_time_magnify(), result, TIME_FIXOFF_P, time_new_timew(), TIME_SET_FIXOFF, TIME_SET_UTC, TIME_UTC_P, time_object::timew, vtm::utc_offset, v2w(), time_object::vtm, wadd(), and wsub().

Referenced by time_minus(), time_plus(), and time_round().

static void time_arg | ( | int | argc,
|  | VALUE * | argv,
|  | struct vtm * | vtm
| ) |  |
| static

Definition at line 2706 of file time.c.

References vtm::hour, INT2FIX, vtm::isdst, vtm::mday, vtm::min, vtm::mon, month_arg(), NIL_P(), obj2int(), obj2subsecx(), obj2vint(), Qnil, rb_scan_args(), RTEST, vtm::sec, vtm::subsecx, usec2subsecx(), vtm::utc_offset, validate_vtm(), vtm::wday, vtm::yday, vtm::year, and vtm::zone.

Referenced by time_utc_or_local().

static VALUE time_asctime | ( | VALUE | time | ) |
| static

Definition at line 3722 of file time.c.

References rb_usascii_encoding(), and strftimev().

Referenced by Init_Time().

static VALUE time_cmp | ( | VALUE | time1,
|  | VALUE | time2
| ) |  |
| static

Definition at line 3401 of file time.c.

References GetTimeval, INT2FIX, IsTimeval, n, rb_invcmp(), time_object::timew, and wcmp().

Referenced by Init_Time().

static VALUE time_dump | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 4763 of file time.c.

References rb_scan_args(), str, and time_mdump().

Referenced by Init_Time().

static VALUE time_dup | ( | VALUE | time | ) |
| static

Definition at line 3499 of file time.c.

References rb_obj_class(), time_init_copy(), and time_s_alloc().

Referenced by time_getgmtime(), and time_getlocaltime().

static VALUE time_eql | ( | VALUE | time1,
|  | VALUE | time2
| ) |  |
| static

Definition at line 3428 of file time.c.

References GetTimeval, IsTimeval, Qfalse, rb_equal(), time_object::timew, and w2v().

Referenced by Init_Time().

static VALUE time_fixoff | ( | VALUE | time | ) |
| static

Definition at line 3610 of file time.c.

References GetTimeval, gmtimew(), INT2FIX, rb_eArgError, rb_raise(), time, TIME_FIXOFF_P, time_modify(), TIME_SET_FIXOFF, time_object::timew, time_object::tm_got, vtm::utc_offset, time_object::vtm, and vtm_add_offset().

Referenced by time_get_tm(), time_getlocaltime(), time_localtime_m(), and time_mload().

static void time_free | ( | void * | tobj | ) |
| static

Definition at line 1877 of file time.c.

References xfree.

static VALUE time_friday | ( | VALUE | time | ) |
| static

Definition at line 4188 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_get_tm | ( | VALUE | time,
|  | struct time_object * | tobj
| ) |  |
| static

Definition at line 3702 of file time.c.

References time_fixoff(), TIME_FIXOFF_P, time_gmtime(), time_localtime(), and TIME_UTC_P.

static VALUE time_getgmtime | ( | VALUE | time | ) |
| static

Definition at line 3696 of file time.c.

References time_dup(), and time_gmtime().

Referenced by Init_Time().

static VALUE time_getlocaltime | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 3664 of file time.c.

References NIL_P(), rb_scan_args(), time_dup(), time_fixoff(), time_localtime(), time_set_utc_offset(), utc_offset_arg(), and validate_utc_offset().

Referenced by Init_Time().

static VALUE time_gmtime | ( | VALUE | time | ) |
| static

Definition at line 3586 of file time.c.

References GetTimeval, gmtimew(), rb_eArgError, rb_raise(), time, time_modify(), TIME_SET_UTC, TIME_UTC_P, time_object::timew, time_object::tm_got, and time_object::vtm.

Referenced by Init_Time(), time_get_tm(), time_getgmtime(), and time_utc_or_local().

static VALUE time_hash | ( | VALUE | time | ) |
| static

Definition at line 3476 of file time.c.

References GetTimeval, rb_hash(), time_object::timew, and w2v().

Referenced by Init_Time().

static VALUE time_hour | ( | VALUE | time | ) |
| static

Definition at line 3989 of file time.c.

References GetTimeval, vtm::hour, INT2FIX, MAKE_TM, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_init | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 2302 of file time.c.

References time_init_0(), and time_init_1().

Referenced by Init_Time().

static VALUE time_init_0 | ( | VALUE | time | ) |
| static

Definition at line 1988 of file time.c.

References GetNewTimeval, gettimeofday(), time_object::gmt, rb_sys_fail(), time, time_modify(), timespec2timew(), time_object::timew, time_object::tm_got, timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, timeval::tv_usec, and WINT2FIXWV.

Referenced by time_init().

static VALUE time_init_1 | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 2197 of file time.c.

References arg, GetNewTimeval, time_object::gmt, vtm::hour, ID2SYM, INT2FIX, vtm::isdst, vtm::mday, vtm::min, vtm::mon, month_arg(), neg, NIL_P(), obj2int(), obj2subsecx(), obj2vint(), Qnil, rb_intern, rb_scan_args(), vtm::sec, vtm::subsecx, time_localtime(), time_modify(), time_set_utc_offset(), timegmw(), timelocalw(), time_object::timew, time_object::tm_got, vtm::utc_offset, utc_offset_arg(), validate_vtm(), vtm_add_offset(), vtm::wday, WINT2FIXWV, vtm::yday, vtm::year, and vtm::zone.

Referenced by time_init().

static VALUE time_init_copy | ( | VALUE | copy,
|  | VALUE | time
| ) |  |
| static

Definition at line 3486 of file time.c.

References GetNewTimeval, GetTimeval, MEMCPY, and OBJ_INIT_COPY.

Referenced by Init_Time(), and time_dup().

static VALUE time_isdst | ( | VALUE | time | ) |
| static

Definition at line 4255 of file time.c.

References GetTimeval, vtm::isdst, MAKE_TM, Qfalse, Qtrue, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_load | ( | VALUE | klass,
|  | VALUE | str
| ) |  |
| static

Definition at line 4898 of file time.c.

References time, time_mload(), and time_s_alloc().

Referenced by Init_Time().

static VALUE time_localtime | ( | VALUE | time | ) |
| static

Definition at line 3507 of file time.c.

References GetTimeval, localtimew(), rb_eArgError, rb_raise(), time, TIME_LOCALTIME_P, time_modify(), TIME_SET_LOCALTIME, time_object::timew, time_object::tm_got, and time_object::vtm.

Referenced by time_get_tm(), time_getlocaltime(), time_init_1(), time_localtime_m(), and time_utc_or_local().

static VALUE time_localtime_m | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 3551 of file time.c.

References NIL_P(), rb_scan_args(), time_fixoff(), time_localtime(), time_set_utc_offset(), utc_offset_arg(), and validate_utc_offset().

Referenced by Init_Time().

static void time_mark | ( | void * | ptr | ) |
| static

Definition at line 1865 of file time.c.

References FIXWV_P, ptr, rb_gc_mark(), vtm::subsecx, time_object::timew, vtm::utc_offset, time_object::vtm, w2v(), and vtm::year.

static VALUE time_mday | ( | VALUE | time | ) |
| static

Definition at line 4011 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, vtm::mday, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_mdump | ( | VALUE | time | ) |
| static

Definition at line 4662 of file time.c.

References add(), buf, div, divmodv(), FIX2LONG, FIXNUM_P, GetTimeval, gmtimew(), vtm::hour, i, id_nano_den, id_nano_num, id_offset, id_submicro, id_zone, int, INT2FIX, LONG2FIX, vtm::mday, vtm::min, mod(), vtm::mon, mulquo, p, rb_copy_generic_ivar(), rb_eArgError, rb_equal(), rb_Integer(), rb_ivar_set(), rb_locale_str_new_cstr(), rb_raise(), rb_str_new(), RB_TYPE_P, RRATIONAL, s, vtm::sec, str, vtm::subsecx, T_RATIONAL, TIME_SCALE, time_utc_offset(), TIME_UTC_P, time_object::timew, v, time_object::vtm, vtm::year, and vtm::zone.

Referenced by Init_Time(), and time_dump().

static size_t time_memsize | ( | const void * | tobj | ) |
| static

Definition at line 1883 of file time.c.

static VALUE time_min | ( | VALUE | time | ) |
| static

Definition at line 3969 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, vtm::min, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_minus | ( | VALUE | time1,
|  | VALUE | time2
| ) |  |
| static

Definition at line 3815 of file time.c.

References GetTimeval, IsTimeval, rb_Float(), rb_time_unmagnify_to_float(), time_add(), time_object::timew, and wsub().

Referenced by Init_Time().

static VALUE time_mload | ( | VALUE | time,
|  | VALUE | str
| ) |  |
| static

Definition at line 4775 of file time.c.

References add(), buf, data, digit, get_attr, GetNewTimeval, time_object::gmt, vtm::hour, i, int, INT2FIX, vtm::isdst, len, LONG2FIX, vtm::mday, vtm::min, vtm::mon, mulquo, NIL_P(), NULL, num_exact(), p, ptr, Qnil, quo(), rb_copy_generic_ivar(), rb_eTypeError, rb_raise(), rb_rescue(), rb_time_magnify(), RSTRING_LEN, RSTRING_PTR, s, vtm::sec, StringValue, StringValuePtr, vtm::subsecx, time, time_fixoff(), time_modify(), TIME_SCALE, TIME_SET_UTC, time_set_utc_offset(), timegmw(), TIMET2WV, time_object::timew, time_object::tm_got, vtm::utc_offset, validate_utc_offset(), validate_zone_name(), time_object::vtm, wadd(), vtm::wday, WINT2FIXWV, wmulquoll, vtm::yday, vtm::year, and vtm::zone.

Referenced by Init_Time(), and time_load().

static void time_modify | ( | VALUE | time | ) |
| static

Definition at line 1930 of file time.c.

References rb_check_frozen, and rb_check_trusted.

Referenced by time_fixoff(), time_gmtime(), time_init_0(), time_init_1(), time_localtime(), time_mload(), and time_set_utc_offset().

static VALUE time_mon | ( | VALUE | time | ) |
| static

Definition at line 4033 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, vtm::mon, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_monday | ( | VALUE | time | ) |
| static

Definition at line 4124 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_new_timew | ( | VALUE | klass,
|  | wideval_t | timew
| ) |  |
| static

Definition at line 2351 of file time.c.

References DATA_PTR(), time_object::gmt, time, time_s_alloc(), and time_object::timew.

Referenced by rb_time_nano_new(), rb_time_new(), rb_time_num_new(), rb_time_succ(), time_add(), time_s_at(), and time_utc_or_local().

static VALUE time_nsec | ( | VALUE | time | ) |
| static

Definition at line 3339 of file time.c.

References GetTimeval, rb_to_int(), TIME_SCALE, time_object::timew, w2v(), WINT2WV, wmod(), and wmulquoll.

Referenced by Init_Time().

static void time_overflow_p | ( | time_t * | secp,
|  | long * | nsecp
| ) |  |
| static

Definition at line 2311 of file time.c.

References NDIV, NMOD, rb_eArgError, rb_eRangeError, rb_raise(), and tmp.

Referenced by nsec2timew().

static VALUE time_plus | ( | VALUE | time1,
|  | VALUE | time2
| ) |  |
| static

Definition at line 3788 of file time.c.

References GetTimeval, IsTimeval, rb_eTypeError, rb_raise(), and time_add().

Referenced by Init_Time().

static VALUE time_round | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | time
| ) |  |
| static

Definition at line 3898 of file time.c.

References a, b, GetTimeval, INT2FIX, lt, mod(), mul(), NIL_P(), NUM2LONG, quo(), rb_eArgError, rb_raise(), rb_scan_args(), rb_time_unmagnify(), rb_to_int(), sub(), time_add(), time_object::timew, v, and w2v().

Referenced by Init_Time().

static VALUE time_s_alloc | ( | VALUE | klass | ) |
| static

Definition at line 1894 of file time.c.

References time_object::gmt, obj, time_data_type, time_object::timew, time_object::tm_got, TypedData_Make_Struct, and WINT2FIXWV.

Referenced by Init_Time(), time_dup(), time_load(), and time_new_timew().

static VALUE time_s_at | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | klass
| ) |  |
| static

Definition at line 2567 of file time.c.

References GetTimeval, IsTimeval, num_exact(), rb_scan_args(), rb_time_magnify(), t, time, TIME_COPY_GMT, time_new_timew(), TIME_SCALE, time_object::timew, v2w(), wadd(), and wmulquoll.

Referenced by Init_Time().

static VALUE time_s_mktime | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | klass
| ) |  |
| static

Definition at line 3215 of file time.c.

References FALSE, and time_utc_or_local().

Referenced by Init_Time().

static VALUE time_s_mkutc | ( | int | argc,
|  | VALUE * | argv,
|  | VALUE | klass
| ) |  |
| static

Definition at line 3184 of file time.c.

References time_utc_or_local(), and TRUE.

Referenced by Init_Time().

static VALUE time_s_now | ( | VALUE | klass | ) |
| static

Definition at line 2538 of file time.c.

References NULL, and rb_class_new_instance().

Referenced by Init_Time().

static VALUE time_saturday | ( | VALUE | time | ) |
| static

Definition at line 4204 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_sec | ( | VALUE | time | ) |
| static

Definition at line 3949 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, vtm::sec, and time_object::vtm.

Referenced by Init_Time().

static VALUE time_set_utc_offset | ( | VALUE | time,
|  | VALUE | off
| ) |  |
| static

Definition at line 2018 of file time.c.

References GetTimeval, num_exact(), time, time_modify(), TIME_SET_FIXOFF, and time_object::tm_got.

Referenced by rb_time_num_new(), time_getlocaltime(), time_init_1(), time_localtime_m(), and time_mload().

static VALUE time_strftime | ( | VALUE | time,
|  | VALUE | format
| ) |  |
| static

Definition at line 4610 of file time.c.

References buf, enc, fmt, GetTimeval, len, MAKE_TM, p, rb_eArgError, rb_enc_get(), rb_enc_str_asciicompat_p, rb_enc_str_new(), rb_raise(), rb_str_cat(), rb_str_new(), rb_str_new4, rb_strftime_alloc(), rb_warning(), RSTRING_LEN, RSTRING_PTR, SMALLBUF, str, StringValue, strlen(), TIME_UTC_P, time_object::timew, time_object::vtm, and xfree.

Referenced by Init_Time().

static VALUE time_subsec | ( | VALUE | time | ) |
| static

Definition at line 3367 of file time.c.

References GetTimeval, INT2FIX, quo(), TIME_SCALE, time_object::timew, w2v(), WINT2FIXWV, and wmod().

Referenced by Init_Time().

static VALUE time_sunday | ( | VALUE | time | ) |
| static

Definition at line 4108 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_thursday | ( | VALUE | time | ) |
| static

Definition at line 4172 of file time.c.

References wday_p.

Referenced by Init_Time().

static struct timespec time_timespec | ( | VALUE | num,
|  | int | interval
| ) |  |
| static

Definition at line 2411 of file time.c.

References ary, d, f, i, id_divmod, id_mul, int, INT2FIX, NIL_P(), NUM2LONG, Qundef, rb_ary_entry(), rb_check_array_type(), rb_check_funcall(), rb_eArgError, rb_eRangeError, rb_eTypeError, rb_funcall(), rb_obj_classname(), rb_raise(), RFLOAT_VALUE, t, T_BIGNUM, T_FIXNUM, T_FLOAT, timespec::tv_nsec, timespec::tv_sec, and TYPE.

Referenced by rb_time_timespec(), and time_timeval().

static struct timeval time_timeval | ( | VALUE | num,
|  | int | interval
| ) |  |
| static

Definition at line 2479 of file time.c.

References time_timespec(), timespec::tv_nsec, timeval::tv_sec, timespec::tv_sec, timeval::tv_usec, TYPEOF_TIMEVAL_TV_SEC, and TYPEOF_TIMEVAL_TV_USEC.

Referenced by rb_time_interval(), and rb_time_timeval().

static VALUE time_to_a | ( | VALUE | time | ) |
| static

Definition at line 4342 of file time.c.

References GetTimeval, vtm::hour, INT2FIX, vtm::isdst, MAKE_TM, vtm::mday, vtm::min, vtm::mon, Qfalse, Qtrue, rb_ary_new3(), vtm::sec, time_zone(), time_object::vtm, vtm::wday, vtm::yday, and vtm::year.

Referenced by Init_Time().

static VALUE time_to_f | ( | VALUE | time | ) |
| static

Definition at line 3258 of file time.c.

References GetTimeval, rb_Float(), rb_time_unmagnify_to_float(), and time_object::timew.

Referenced by Init_Time().

static VALUE time_to_i | ( | VALUE | time | ) |
| static

Definition at line 3234 of file time.c.

References GetTimeval, TIME_SCALE, time_object::timew, w2v(), wdiv(), and WINT2FIXWV.

Referenced by Init_Time().

static VALUE time_to_r | ( | VALUE | time | ) |
| static

Definition at line 3282 of file time.c.

References GetTimeval, rb_Rational1, rb_time_unmagnify(), RB_TYPE_P, T_RATIONAL, time_object::timew, v, and w2v().

Referenced by Init_Time().

static VALUE time_to_s | ( | VALUE | time | ) |
| static

Definition at line 3744 of file time.c.

References GetTimeval, rb_usascii_encoding(), strftimev(), and TIME_UTC_P.

Referenced by Init_Time().

static VALUE time_tuesday | ( | VALUE | time | ) |
| static

Definition at line 4140 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_usec | ( | VALUE | time | ) |
| static

Definition at line 3308 of file time.c.

References GetTimeval, q, r, rb_to_int(), TIME_SCALE, time_object::timew, w2v(), WINT2FIXWV, WINT2WV, wmod(), and wmuldivmod().

Referenced by Init_Time().

static VALUE time_utc_offset | ( | VALUE | time | ) |
| static

Definition at line 4309 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, TIME_UTC_P, vtm::utc_offset, and time_object::vtm.

Referenced by Init_Time(), and time_mdump().

static VALUE time_utc_or_local | ( | int | argc,
|  | VALUE * | argv,
|  | int | utc_p,
|  | VALUE | klass
| ) |  |
| static

Definition at line 3137 of file time.c.

References time, time_arg(), time_gmtime(), time_localtime(), time_new_timew(), timegmw(), and timelocalw().

Referenced by time_s_mktime(), and time_s_mkutc().

static VALUE time_utc_p | ( | VALUE | time | ) |
| static

Definition at line 3459 of file time.c.

References GetTimeval, Qfalse, Qtrue, and TIME_UTC_P.

Referenced by Init_Time().

static VALUE time_wday | ( | VALUE | time | ) |
| static

Definition at line 4081 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, time_object::vtm, and vtm::wday.

Referenced by Init_Time().

static VALUE time_wednesday | ( | VALUE | time | ) |
| static

Definition at line 4156 of file time.c.

References wday_p.

Referenced by Init_Time().

static VALUE time_yday | ( | VALUE | time | ) |
| static

Definition at line 4220 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, time_object::vtm, and vtm::yday.

Referenced by Init_Time().

static VALUE time_year | ( | VALUE | time | ) |
| static

Definition at line 4053 of file time.c.

References GetTimeval, MAKE_TM, time_object::vtm, and vtm::year.

Referenced by Init_Time().

static VALUE time_zone | ( | VALUE | time | ) |
| static

Definition at line 4278 of file time.c.

References GetTimeval, MAKE_TM, NULL, Qnil, rb_locale_str_new_cstr(), rb_obj_untaint(), TIME_UTC_P, time_object::vtm, and vtm::zone.

Referenced by Init_Time(), and time_to_a().

static time_t timegm_noleapsecond | ( | struct tm * | tm | ) |
| static

Definition at line 2780 of file time.c.

References DIV, and leap_year_p().

Referenced by find_time_t().

static wideval_t timegmw | ( | struct vtm * | vtm | ) |
| static

Definition at line 1335 of file time.c.

References find_time_t(), gt, vtm::hour, init_leap_second_info(), INT2FIX, vtm::mday, vtm::min, vtm::mon, NUM2LONG, rb_eArgError, rb_long2int, rb_raise(), rb_time_magnify(), vtm::sec, vtm::subsecx, t, timegmw_noleapsecond(), TIMET2WV, v2w(), wadd(), WINT2WV, wlt, and vtm::year.

Referenced by guess_local_offset(), time_init_1(), time_mload(), time_utc_or_local(), and timelocalw().

static wideval_t timegmw_noleapsecond | ( | struct vtm * | vtm | ) |
| static

Definition at line 991 of file time.c.

References add(), calc_tm_yday(), DIV, divmodv(), vtm::hour, INT2FIX, LONG2NUM, vtm::mday, vtm::min, vtm::mon, mul(), NUM2INT, rb_time_magnify(), ret, vtm::sec, sub(), vtm::subsecx, v2w(), wadd(), WINT2FIXWV, wmul(), and vtm::year.

Referenced by init_leap_second_info(), and timegmw().

static wideval_t timelocalw | ( | struct vtm * | vtm | ) |
| static

Definition at line 1612 of file time.c.

References find_time_t(), FIX2LONG, FIXNUM_P, vtm::hour, int, INT2FIX, INT2NUM, vtm::isdst, localtimew(), lt, vtm::mday, vtm::min, vtm::mon, n, NUM2INT, rb_eArgError, rb_raise(), rb_time_magnify(), vtm::sec, small_vtm_sub(), sub(), vtm::subsecx, t, timegmw(), TIMET2WV, vtm::utc_offset, v, v2w(), vtmcmp(), wadd(), weq(), WINT2FIXWV, wsub(), and vtm::year.

Referenced by time_init_1(), and time_utc_or_local().

static wideval_t timespec2timew | ( | struct timespec * | ts | ) |
| static

Definition at line 1937 of file time.c.

References rb_time_magnify(), TIME_SCALE, TIMET2WV, time_object::timew, timespec::tv_nsec, timespec::tv_sec, wadd(), WINT2WV, and wmulquoll.

Referenced by nsec2timew(), and time_init_0().

static wideval_t timet2wv | ( | time_t | t | ) |
| static

Definition at line 803 of file time.c.

References FIXWV_MAX, FIXWV_MIN, TIMET_MIN, v2w(), and WINT2FIXWV.

static struct timespec timew2timespec | ( | wideval_t | timew | ) |
| static

Definition at line 1948 of file time.c.

References INT2FIX, mulquo, NUM2LONG, rb_eArgError, rb_raise(), split_second(), TIME_SCALE, timew_out_of_timet_range(), timespec::tv_nsec, timespec::tv_sec, and WV2TIMET.

Referenced by rb_time_timespec(), and rb_time_timeval().

static struct timespec* timew2timespec_exact | ( | wideval_t | timew,
|  | struct timespec * | ts
| ) |  |
| static

Definition at line 1963 of file time.c.

References FIXNUM_P, INT2FIX, mulquo, NULL, NUM2LONG, split_second(), TIME_SCALE, timew_out_of_timet_range(), timespec::tv_nsec, timespec::tv_sec, and WV2TIMET.

Referenced by rb_strftime_alloc().

static int timew_out_of_timet_range | ( | wideval_t | timew | ) |
| static

Definition at line 1745 of file time.c.

References add(), FIXWV2WINT, FIXWV_P, INT2FIX, le, lt, mul(), t, TIME_SCALE, TIMET_MAX, TIMET_MIN, and w2v().

Referenced by localtimew(), timew2timespec(), and timew2timespec_exact().

static int tmcmp | ( | struct tm * | a,
|  | struct tm * | b
| ) |  |
| static

Definition at line 3118 of file time.c.

Referenced by find_time_t().

static long usec2subsecx | ( | VALUE | obj | ) |
| static

Definition at line 2638 of file time.c.

References FALSE, INT2FIX, mulquo, num_exact(), rb_str_to_inum(), RB_TYPE_P, T_STRING, and TIME_SCALE.

Referenced by time_arg().

static VALUE utc_offset_arg | ( | VALUE | arg | ) |
| static

Definition at line 2161 of file time.c.

References INT2FIX, ISDIGIT, n, NIL_P(), num_exact(), rb_check_string_type(), rb_eArgError, rb_enc_str_asciicompat_p, rb_raise(), RSTRING_LEN, RSTRING_PTR, s, and tmp.

Referenced by rb_time_num_new(), time_getlocaltime(), time_init_1(), and time_localtime_m().

static wideval_t v2w | ( | VALUE | v | ) |
| inline static

Definition at line 392 of file time.c.

References BDIGIT, FIXNUM_P, RB_TYPE_P, RBIGNUM_LEN, T_BIGNUM, and WIDEVAL_WRAP.

Referenced by localtimew(), obj2subsecx(), rb_time_num_new(), time_add(), time_s_at(), timegmw(), timegmw_noleapsecond(), timelocalw(), timet2wv(), vtm_add_offset(), wadd(), wdivmod(), wmul(), wquo(), and wsub().

static VALUE validate_utc_offset | ( | VALUE | utc_offset | ) |
| static

Definition at line 2677 of file time.c.

References ge, INT2FIX, le, rb_eArgError, and rb_raise().

Referenced by rb_time_num_new(), time_getlocaltime(), time_localtime_m(), time_mload(), and validate_vtm().

static void validate_vtm | ( | struct vtm * | vtm | ) |
| static

Definition at line 2692 of file time.c.

References ge, vtm::hour, INT2FIX, lt, vtm::mday, vtm::min, vtm::mon, NIL_P(), rb_eArgError, rb_raise(), vtm::sec, vtm::subsecx, TIME_SCALE, vtm::utc_offset, and validate_utc_offset().

Referenced by time_arg(), and time_init_1().

static VALUE validate_zone_name | ( | VALUE | zone_name | ) |
| static

Definition at line 2685 of file time.c.

References StringValueCStr.

Referenced by time_mload().

static void vtm_add_offset | ( | struct vtm * | vtm,
|  | VALUE | off
| ) |  |
| static

Definition at line 2033 of file time.c.

References add(), common_year_days_in_month, divmodv(), vtm::hour, INT2FIX, le, leap_year_v_p, lt, vtm::mday, vtm::min, min(), vtm::mon, neg, NUM2INT, rb_equal(), rb_time_magnify(), vtm::sec, sub(), vtm::subsecx, TIME_SCALE, vtm::utc_offset, v, v2w(), w2v(), vtm::wday, vtm::yday, and vtm::year.

Referenced by time_fixoff(), and time_init_1().

static int vtmcmp | ( | struct vtm * | a,
|  | struct vtm * | b
| ) |  |
| static

Definition at line 3097 of file time.c.

References vtm::hour, lt, vtm::mday, vtm::min, vtm::mon, ne, vtm::sec, vtm::subsecx, and vtm::year.

Referenced by timelocalw().

static VALUE w2v | ( | wideval_t | w | ) |
| inline static

Definition at line 287 of file time.c.

References FIXWV2WINT, FIXWV_P, and WIDEVAL_GET.

Referenced by gmtimew_noleapsecond(), guess_local_offset(), init_leap_second_info(), obj2subsecx(), rb_strftime_alloc(), rb_time_unmagnify_to_float(), split_second(), time_eql(), time_hash(), time_mark(), time_nsec(), time_round(), time_subsec(), time_to_i(), time_to_r(), time_usec(), timew_out_of_timet_range(), vtm_add_offset(), wadd(), wcmp(), wdivmod(), weq(), wmul(), wquo(), wsub(), and wv2timet().

static wideval_t wadd | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 447 of file time.c.

References FIXWV2WINT, FIXWV_P, r, rb_big_plus(), rb_funcall(), RB_TYPE_P, T_BIGNUM, v2w(), w2v(), and WINT2WV.

Referenced by localtimew(), rb_time_succ(), time_add(), time_mload(), time_s_at(), timegmw(), timegmw_noleapsecond(), timelocalw(), and timespec2timew().

static int wcmp | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 420 of file time.c.

References a, b, FIXWV2WINT, FIXWV_P, id_cmp, rb_cmpint(), rb_funcall(), and w2v().

Referenced by time_cmp().

static wideval_t wdiv | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 650 of file time.c.

References q, r, and wdivmod().

Referenced by time_to_i().

static void wdivmod | ( | wideval_t | wn,
|  | wideval_t | wd,
|  | wideval_t * | wq,
|  | wideval_t * | wr
| ) |  |
| static

Definition at line 570 of file time.c.

References ary, d, FIXWV2WINT, FIXWV_P, id_divmod, n, NIL_P(), q, r, rb_ary_entry(), rb_check_array_type(), rb_eTypeError, rb_funcall(), rb_num_zerodiv(), rb_obj_classname(), rb_raise(), tmp, v2w(), w2v(), WINT2FIXWV, and WINT2WV.

Referenced by gmtimew_noleapsecond(), split_second(), wdiv(), wmod(), and wmuldivmod().

static int weq | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 407 of file time.c.

References eq(), FIXWV_P, id_eq, rb_funcall(), RTEST, w2v(), and WIDEVAL_GET.

Referenced by timelocalw().

static int wi_mul | ( | wideint_t | x,
|  | wideint_t | y,
|  | wideint_t * | z
| ) |  |
| static

Definition at line 479 of file time.c.

References a, b, c, s, UWIDEINT_MAX, and WIDEINT_MAX.

Referenced by rb_time_magnify(), and wmul().

static wideval_t wmod | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 658 of file time.c.

References q, r, and wdivmod().

Referenced by time_nsec(), time_subsec(), and time_usec().

static wideval_t wmul | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 521 of file time.c.

References FIXWV2WINT, FIXWV_P, INT2FIX, rb_big_mul(), rb_funcall(), RB_TYPE_P, RRATIONAL, T_BIGNUM, T_RATIONAL, v2w(), w2v(), wi_mul(), and WINT2WV.

Referenced by rb_time_magnify(), timegmw_noleapsecond(), and wmuldivmod().

static void wmuldivmod | ( | wideval_t | wx,
|  | wideval_t | wy,
|  | wideval_t | wz,
|  | wideval_t * | wq,
|  | wideval_t * | wr
| ) |  |
| static

Definition at line 639 of file time.c.

References wdivmod(), WIDEVAL_GET, WINT2FIXWV, and wmul().

Referenced by time_usec().

static wideval_t wquo | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 541 of file time.c.

References a, b, c, FIXWV2WINT, FIXWV_P, id_quo, INT2FIX, rb_funcall(), rb_num_zerodiv(), RB_TYPE_P, ret, RRATIONAL, T_RATIONAL, v2w(), w2v(), and WINT2WV.

Referenced by rb_time_unmagnify().

static wideval_t wsub | ( | wideval_t | wx,
|  | wideval_t | wy
| ) |  |
| static

Definition at line 463 of file time.c.

References FIXWV2WINT, FIXWV_P, r, rb_big_minus(), rb_funcall(), RB_TYPE_P, T_BIGNUM, v2w(), w2v(), and WINT2WV.

Referenced by gmtimew(), init_leap_second_info(), time_add(), time_minus(), and timelocalw().

static time_t wv2timet | ( | wideval_t | w | ) |
| static

Definition at line 824 of file time.c.

References FIXWV2WINT, FIXWV_P, rb_eRangeError, rb_raise(), TIMET_MAX, TIMET_MIN, and w2v().

static const char* zone_str | ( | const char * | s | ) |
| static

Definition at line 1049 of file time.c.

References s, st_init_strtable(), st_update(), and zone_str_update().

Referenced by localtime_with_gmtoff_zone().

static int zone_str_update | ( | st_data_t * | key,
|  | st_data_t * | value,
|  | st_data_t | arg,
|  | int | existing
| ) |  |
| static

Definition at line 1034 of file time.c.

References ret, s, ST_CONTINUE, ST_STOP, and strdup.

Referenced by zone_str().

## Variable Documentation

const int common_year_days_in_month[]
| static

Initial value:
= {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
}

Definition at line 969 of file time.c.

Referenced by gmtime_with_leapsecond(), and vtm_add_offset().

const int common_year_yday_offset[]
| static

Initial value:
= {
-1,
-1 + 31,
-1 + 31 + 28,
-1 + 31 + 28 + 31,
-1 + 31 + 28 + 31 + 30,
-1 + 31 + 28 + 31 + 30 + 31,
-1 + 31 + 28 + 31 + 30 + 31 + 30,
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31,
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31,
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
-1 + 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
}

Definition at line 938 of file time.c.

Referenced by gmtimew_noleapsecond().

int compat_common_month_table[12][7]
| static

Initial value:
= {
{ 2034, 2035, 2036, 2031, 2032, 2027, 2033 },
{ 2026, 2027, 2033, 2034, 2035, 2030, 2031 },
{ 2026, 2032, 2033, 2034, 2035, 2030, 2036 },
{ 2035, 2030, 2036, 2026, 2032, 2033, 2034 },
{ 2033, 2034, 2035, 2030, 2036, 2026, 2032 },
{ 2036, 2026, 2032, 2033, 2034, 2035, 2030 },
{ 2035, 2030, 2036, 2026, 2032, 2033, 2034 },
{ 2032, 2033, 2034, 2035, 2030, 2036, 2026 },
{ 2030, 2036, 2026, 2032, 2033, 2034, 2035 },
{ 2034, 2035, 2030, 2036, 2026, 2032, 2033 },
{ 2026, 2032, 2033, 2034, 2035, 2030, 2036 },
{ 2030, 2036, 2026, 2032, 2033, 2034, 2035 },
}

Definition at line 1447 of file time.c.

int compat_leap_month_table[7]
| static

Initial value:
= {
2032, 2016, 2028, 2012, 2024, 2036, 2020,
}

Definition at line 1488 of file time.c.

ID id_cmp
| static

Definition at line 37 of file time.c.

Referenced by cmp(), Init_Time(), and wcmp().

ID id_div
| static

Definition at line 37 of file time.c.

Referenced by Init_Time().

ID id_divmod
| static

Definition at line 36 of file time.c.

Referenced by divmodv(), Init_Time(), time_timespec(), and wdivmod().

ID id_eq
| static

Definition at line 37 of file time.c.

Referenced by eq(), Init_Time(), and weq().

ID id_lshift
| static

Definition at line 37 of file time.c.

Referenced by Init_Time().

ID id_mul
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_timespec().

ID id_nano_den
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_mdump().

ID id_nano_num
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_mdump().

ID id_ne
| static

Definition at line 37 of file time.c.

Referenced by Init_Time().

ID id_offset
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_mdump().

ID id_quo
| static

Definition at line 37 of file time.c.

Referenced by Init_Time(), quo(), and wquo().

ID id_submicro
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_mdump().

ID id_zone
| static

Definition at line 36 of file time.c.

Referenced by Init_Time(), and time_mdump().

time_t known_leap_seconds_limit
| static

Definition at line 1289 of file time.c.

const int leap_year_days_in_month[]
| static

Initial value:
= {
31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
}

Definition at line 972 of file time.c.

const int leap_year_yday_offset[]
| static

Initial value:
= {
-1,
-1 + 31,
-1 + 31 + 29,
-1 + 31 + 29 + 31,
-1 + 31 + 29 + 31 + 30,
-1 + 31 + 29 + 31 + 30 + 31,
-1 + 31 + 29 + 31 + 30 + 31 + 30,
-1 + 31 + 29 + 31 + 30 + 31 + 30 + 31,
-1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31,
-1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30,
-1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31,
-1 + 31 + 29 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30
}

Definition at line 953 of file time.c.

Referenced by gmtimew_noleapsecond().

const char months[][4]
| static

Initial value:
= {
"jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec",
}

Definition at line 2593 of file time.c.

int number_of_leap_seconds_known
| static

Definition at line 1290 of file time.c.

VALUE rb_cTime

Definition at line 846 of file time.c.

long this_year = 0
| static

Definition at line 1288 of file time.c.

const rb_data_type_t time_data_type
| static

Initial value:
= {
"time",
{time_mark, time_free, time_memsize,},
}
time_memsize
static size_t time_memsize(const void *tobj)
Definition: time.c:1883
time_free
static void time_free(void *tobj)
Definition: time.c:1877
time_mark
static void time_mark(void *ptr)
Definition: time.c:1865

Definition at line 1888 of file time.c.

Referenced by get_new_timeval(), get_timeval(), and time_s_alloc().

st_table* zone_table
| static

Definition at line 1031 of file time.c.