Ruby: timev.h Source File

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

timev.h
1#ifndef RUBY_TIMEV_H
2#define RUBY_TIMEV_H
3#include "ruby/ruby.h"
4
5 struct vtm {
6 VALUE year; /* 2000 for example. Integer. */
7 VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
8 VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
9 VALUE zone; /* "JST", "EST", "EDT", etc. as String */
10 unsigned int yday:9; /* 1..366 */
11 unsigned int mon:4; /* 1..12 */
12 unsigned int mday:5; /* 1..31 */
13 unsigned int hour:5; /* 0..23 */
14 unsigned int min:6; /* 0..59 */
15 unsigned int sec:6; /* 0..60 */
16 unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
17 unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
18
19 /* Flags for struct time_object */
20 unsigned int tzmode:3; /* 0:localtime 1:utc 2:fixoff 3:uninitialized */
21 unsigned int tm_got:1;
22};
23
24#define TIME_SCALE 1000000000
25
26#ifndef TYPEOF_TIMEVAL_TV_SEC
27# define TYPEOF_TIMEVAL_TV_SEC time_t
28#endif
29#ifndef TYPEOF_TIMEVAL_TV_USEC
30# if INT_MAX >= 1000000
31# define TYPEOF_TIMEVAL_TV_USEC int
32# else
33# define TYPEOF_TIMEVAL_TV_USEC long
34# endif
35#endif
36
37#if SIZEOF_TIME_T == SIZEOF_LONG
38typedef unsigned long unsigned_time_t;
39#elif SIZEOF_TIME_T == SIZEOF_INT
40typedef unsigned int unsigned_time_t;
41#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
42typedef unsigned LONG_LONG unsigned_time_t;
43#else
44# error cannot find integer type which size is same as time_t.
45#endif
46
47/* strftime.c */
48#ifdef RUBY_ENCODING_H
49 VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
50 VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt);
51 VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
52 VALUE time, const struct vtm *vtm, VALUE timev, int gmt);
53#endif
54
55/* time.c */
56 VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time);
57
58#endif
LONG_LONG
#define LONG_LONG
Definition long_long.h:38
ruby.h
OnigEncodingTypeST
Definition onigmo.h:160
timespec
Definition missing.h:74
vtm
Definition timev.h:5
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40