Ruby: include/ruby/internal/intern/time.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

time.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_TIME_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_TIME_H
23#include "ruby/internal/config.h"
24
25#ifdef HAVE_TIME_H
26# include <time.h> /* for time_t */
27#endif
28
29#include "ruby/internal/attr/nonnull.h"
30#include "ruby/internal/dllexport.h"
31#include "ruby/internal/value.h"
32
33 RBIMPL_SYMBOL_EXPORT_BEGIN()
34
35struct timespec;
36struct timeval;
37
38/* time.c */
39
40 RBIMPL_ATTR_NONNULL(())
48void rb_timespec_now(struct timespec *ts);
49
59 VALUE rb_time_new(time_t sec, long usec);
60
70 VALUE rb_time_nano_new(time_t sec, long nsec);
71
72 RBIMPL_ATTR_NONNULL(())
84 VALUE rb_time_timespec_new(const struct timespec *ts, int offset);
85
106 VALUE rb_time_num_new(VALUE timev, VALUE off);
107
118struct timeval rb_time_interval(VALUE num);
119
129struct timeval rb_time_timeval(VALUE time);
130
138struct timespec rb_time_timespec(VALUE time);
139
148struct timespec rb_time_timespec_interval(VALUE num);
149
157 VALUE rb_time_utc_offset(VALUE time);
158
159 RBIMPL_SYMBOL_EXPORT_END()
160
161#endif /* RBIMPL_INTERN_TIME_H */
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
time.h
Public APIs related to rb_cTime.
rb_time_nano_new
VALUE rb_time_nano_new(time_t sec, long nsec)
Identical to rb_time_new(), except it accepts the time in nanoseconds resolution.
Definition time.c:2701
rb_timespec_now
void rb_timespec_now(struct timespec *ts)
Fills the current time into the given struct.
Definition time.c:1931
rb_time_timespec_new
VALUE rb_time_timespec_new(const struct timespec *ts, int offset)
Creates an instance of rb_cTime, with given time and offset.
Definition time.c:2707
rb_time_timespec
struct timespec rb_time_timespec(VALUE time)
Identical to rb_time_timeval(), except for return type.
Definition time.c:2870
rb_time_new
VALUE rb_time_new(time_t sec, long usec)
Creates an instance of rb_cTime with the given time and the local timezone.
Definition time.c:2693
rb_time_timeval
struct timeval rb_time_timeval(VALUE time)
Converts an instance of rb_cTime to a struct timeval that represents the identical point of time.
Definition time.c:2853
rb_time_interval
struct timeval rb_time_interval(VALUE num)
Creates a "time interval".
Definition time.c:2847
rb_time_num_new
VALUE rb_time_num_new(VALUE timev, VALUE off)
Identical to rb_time_timespec_new(), except it takes Ruby values instead of C structs.
Definition time.c:2730
rb_time_utc_offset
VALUE rb_time_utc_offset(VALUE time)
Queries the offset, in seconds between the time zone of the time and the UTC.
Definition time.c:4984
rb_time_timespec_interval
struct timespec rb_time_timespec_interval(VALUE num)
Identical to rb_time_interval(), except for return type.
Definition time.c:2884
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition nonnull.h:30
timespec
Definition missing.h:74
timeval
Definition missing.h:63
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40