Ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a25176072e02db9254f0e0c84c805cd)
timev.h
Go to the documentation of this file.
1#ifndef RUBY_TIMEV_H
2#define RUBY_TIMEV_H
3
4#if 0
5struct vtm {/* dummy for TAGS */};
6#endif
8 VALUE year; /* 2000 for example. Integer. */
9 VALUE subsecx; /* 0 <= subsecx < TIME_SCALE. possibly Rational. */
10 VALUE utc_offset; /* -3600 as -01:00 for example. possibly Rational. */
11 VALUE zone; /* "JST", "EST", "EDT", etc. as String */
12 unsigned int yday:9; /* 1..366 */
13 unsigned int mon:4; /* 1..12 */
14 unsigned int mday:5; /* 1..31 */
15 unsigned int hour:5; /* 0..23 */
16 unsigned int min:6; /* 0..59 */
17 unsigned int sec:6; /* 0..60 */
18 unsigned int wday:3; /* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
19 unsigned int isdst:2; /* 0:StandardTime 1:DayLightSavingTime 3:init */
20});
21
22#define TIME_SCALE 1000000000
23
24#ifndef TYPEOF_TIMEVAL_TV_SEC
25# define TYPEOF_TIMEVAL_TV_SEC time_t
26#endif
27#ifndef TYPEOF_TIMEVAL_TV_USEC
28# if INT_MAX >= 1000000
29# define TYPEOF_TIMEVAL_TV_USEC int
30# else
31# define TYPEOF_TIMEVAL_TV_USEC long
32# endif
33#endif
34
35#if SIZEOF_TIME_T == SIZEOF_LONG
36typedef unsigned long unsigned_time_t;
37#elif SIZEOF_TIME_T == SIZEOF_INT
38typedef unsigned int unsigned_time_t;
39#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
40typedef unsigned LONG_LONG unsigned_time_t;
41#else
42# error cannot find integer type which size is same as time_t.
43#endif
44
45/* strftime.c */
46#ifdef RUBY_ENCODING_H
47VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc,
48 VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt);
49VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc,
50 VALUE time, const struct vtm *vtm, VALUE timev, int gmt);
51#endif
52
53/* time.c */
55
56#endif
time_t time(time_t *_timer)
unsigned long VALUE
#define LONG_LONG
VALUE rb_strftime_timespec(const char *format, size_t format_len, rb_encoding *enc, VALUE time, const struct vtm *vtm, struct timespec *ts, int gmt)
Definition: strftime.c:931
VALUE rb_strftime(const char *format, size_t format_len, rb_encoding *enc, VALUE time, const struct vtm *vtm, VALUE timev, int gmt)
Definition: strftime.c:921
Definition: zonetab.h:35
VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time)
Definition: time.c:5670
unsigned long unsigned_time_t
Definition: timev.h:36
PACKED_STRUCT_UNALIGNED(struct vtm { VALUE year;VALUE subsecx;VALUE utc_offset;VALUE zone;unsigned int yday:9;unsigned int mon:4;unsigned int mday:5;unsigned int hour:5;unsigned int min:6;unsigned int sec:6;unsigned int wday:3;unsigned int isdst:2;})