Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
Functions
time.h File Reference

Public APIs related to rb_cTime. More...

#include "ruby/internal/config.h"
#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"

Go to the source code of this file.

Functions

void rb_timespec_now (struct timespec *)
 
VALUE rb_time_new (time_t, long)
 
VALUE rb_time_nano_new (time_t, long)
 
VALUE rb_time_timespec_new (const struct timespec *, int)
 Returns a time object with UTC/localtime/fixed offset. More...
 
VALUE rb_time_num_new (VALUE, VALUE)
 
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_utc_offset (VALUE time)
 

Detailed Description

Public APIs related to rb_cTime.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file time.h.

Function Documentation

◆ rb_time_interval()

struct timeval rb_time_interval ( VALUE  num)

Definition at line 2684 of file time.c.

References num, and TRUE.

Referenced by rb_io_wait(), and rb_mutex_sleep().

◆ rb_time_nano_new()

VALUE rb_time_nano_new ( time_t  sec,
long  nsec 
)

Definition at line 2534 of file time.c.

References rb_cTime.

◆ rb_time_new()

VALUE rb_time_new ( time_t  sec,
long  usec 
)

Definition at line 2507 of file time.c.

References NDIV, rb_cTime, rb_eRangeError, and rb_raise().

◆ rb_time_num_new()

VALUE rb_time_num_new ( VALUE  timev,
VALUE  off 
)

Definition at line 2568 of file time.c.

References NIL_P, rb_cTime, and UTC_ZONE.

◆ rb_time_timespec()

struct timespec rb_time_timespec ( VALUE  time)

Definition at line 2707 of file time.c.

References FALSE, GetTimeval, IsTimeval, and t.

◆ rb_time_timespec_interval()

struct timespec rb_time_timespec_interval ( VALUE  num)

Definition at line 2721 of file time.c.

References num, and TRUE.

◆ 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 2545 of file time.c.

References GetTimeval, INT2FIX, rb_cTime, rb_eArgError, rb_raise(), timespec::tv_nsec, timespec::tv_sec, TZMODE_SET_FIXOFF, and TZMODE_SET_UTC.

◆ rb_time_timeval()

struct timeval rb_time_timeval ( VALUE  time)

◆ rb_time_utc_offset()

VALUE rb_time_utc_offset ( VALUE  time)

Definition at line 4801 of file time.c.

References GetTimeval, INT2FIX, MAKE_TM, and TZMODE_UTC_P.

Referenced by Init_Time().

◆ rb_timespec_now()

void rb_timespec_now ( struct timespec ts)