Tempfile document updated.
[ruby.git] / timev.h
blobd350a170deb1b2abe381bb6bdd1b5687388ff2e0
1 #ifndef RUBY_TIMEV_H
2 #define RUBY_TIMEV_H
3 #include "ruby/ruby.h"
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 */
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;
24 #define TIME_SCALE 1000000000
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
37 #if SIZEOF_TIME_T == SIZEOF_LONG
38 typedef unsigned long unsigned_time_t;
39 #elif SIZEOF_TIME_T == SIZEOF_INT
40 typedef unsigned int unsigned_time_t;
41 #elif SIZEOF_TIME_T == SIZEOF_LONG_LONG
42 typedef unsigned LONG_LONG unsigned_time_t;
43 #else
44 # error cannot find integer type which size is same as time_t.
45 #endif
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
55 /* time.c */
56 VALUE rb_time_zone_abbreviation(VALUE zone, VALUE time);
58 #endif