Ruby  2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
timev.h
Go to the documentation of this file.
1 #ifndef RUBY_TIMEV_H
2 #define RUBY_TIMEV_H
3 
4 #if 0
5 struct 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
36 typedef unsigned long unsigned_time_t;
37 #elif SIZEOF_TIME_T == SIZEOF_INT
38 typedef unsigned int unsigned_time_t;
39 #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
40 typedef 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
47 VALUE 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);
49 VALUE 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
VALUE
unsigned long VALUE
Definition: ruby.h:102
zone
Definition: zonetab.h:35
unsigned_time_t
unsigned long unsigned_time_t
Definition: timev.h:36
rb_time_zone_abbreviation
VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time)
Definition: time.c:5655
time
time_t time(time_t *_timer)
OnigEncodingTypeST
Definition: onigmo.h:160
LONG_LONG
#define LONG_LONG
Definition: rb_mjit_min_header-2.7.2.h:3942
rb_strftime
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
rb_strftime_timespec
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
timespec
Definition: missing.h:60
PACKED_STRUCT_UNALIGNED
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;})