Ruby
2.5.0dev(2017-10-22revision60238)
timev.h
Go to the documentation of this file.
1
#ifndef RUBY_TIMEV_H
2
#define RUBY_TIMEV_H
3
4
PACKED_STRUCT_UNALIGNED
(
struct
vtm {
5
VALUE
year;
/* 2000 for example. Integer. */
6
VALUE
subsecx;
/* 0 <= subsecx < TIME_SCALE. possibly Rational. */
7
VALUE
utc_offset;
/* -3600 as -01:00 for example. possibly Rational. */
8
const
char
*
zone
;
/* "JST", "EST", "EDT", etc. */
9
uint16_t yday:9;
/* 1..366 */
10
uint8_t
mon:4;
/* 1..12 */
11
uint8_t
mday:5;
/* 1..31 */
12
uint8_t
hour:5;
/* 0..23 */
13
uint8_t
min:6;
/* 0..59 */
14
uint8_t
sec:6;
/* 0..60 */
15
uint8_t
wday:3;
/* 0:Sunday, 1:Monday, ..., 6:Saturday 7:init */
16
uint8_t
isdst:2;
/* 0:StandardTime 1:DayLightSavingTime 3:init */
17
});
18
19
#define TIME_SCALE 1000000000
20
21
#ifndef TYPEOF_TIMEVAL_TV_SEC
22
# define TYPEOF_TIMEVAL_TV_SEC time_t
23
#endif
24
#ifndef TYPEOF_TIMEVAL_TV_USEC
25
# if INT_MAX >= 1000000
26
# define TYPEOF_TIMEVAL_TV_USEC int
27
# else
28
# define TYPEOF_TIMEVAL_TV_USEC long
29
# endif
30
#endif
31
32
#if SIZEOF_TIME_T == SIZEOF_LONG
33
typedef
unsigned
long
unsigned_time_t
;
34
#elif SIZEOF_TIME_T == SIZEOF_INT
35
typedef
unsigned
int
unsigned_time_t
;
36
#elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
37
typedef
unsigned
LONG_LONG
unsigned_time_t
;
38
#else
39
# error cannot find integer type which size is same as time_t.
40
#endif
41
42
#endif
PACKED_STRUCT_UNALIGNED
PACKED_STRUCT_UNALIGNED(struct vtm { VALUE year;VALUE subsecx;VALUE utc_offset;const char *zone;uint16_t yday:9;uint8_t mon:4;uint8_t mday:5;uint8_t hour:5;uint8_t min:6;uint8_t sec:6;uint8_t wday:3;uint8_t isdst:2;})
uint8_t
unsigned char uint8_t
Definition:
sha2.h:100
unsigned_time_t
unsigned long unsigned_time_t
Definition:
timev.h:33
VALUE
unsigned long VALUE
Definition:
ruby.h:85
zone
Definition:
zonetab.h:34
Generated by
1.8.13