method
marshal_dump
v1_8_6_287 -
Show latest stable
- Class:
Time
marshal_dump()public
undocumented
/*
* undocumented
*/
static VALUE
time_mdump(time)
VALUE time;
{
struct time_object *tobj;
struct tm *tm;
unsigned long p, s;
char buf[8];
time_t t;
int i;
GetTimeval(time, tobj);
t = tobj->tv.tv_sec;
tm = gmtime(&t);
if ((tm->tm_year & 0xffff) != tm->tm_year)
rb_raise(rb_eArgError, "year too big to marshal");
p = 0x1UL << 31 | /* 1 */
tm->tm_year << 14 | /* 16 */
tm->tm_mon << 10 | /* 4 */
tm->tm_mday << 5 | /* 5 */
tm->tm_hour; /* 5 */
s = tm->tm_min << 26 | /* 6 */
tm->tm_sec << 20 | /* 6 */
tobj->tv.tv_usec; /* 20 */
for (i=0; i<4; i++) {
buf[i] = p & 0xff;
p = RSHIFT(p, 8);
}
for (i=4; i<8; i++) {
buf[i] = s & 0xff;
s = RSHIFT(s, 8);
}
return rb_str_new(buf, 8);
} Related methods
- Instance methods
- +
- -
- <=>
- _dump
- asctime
- ctime
- day
- dst?
- eql?
- getgm
- getlocal
- getutc
- gmt?
- gmt_offset
- gmtime
- gmtoff
- hash
- hour
- httpdate
- initialize_copy
- inspect
- isdst
- iso8601
- localtime
- marshal_dump
- marshal_load
- mday
- min
- mon
- month
- rfc2822
- rfc822
- sec
- strftime
- succ
- to_a
- to_f
- to_i
- to_s
- to_yaml
- tv_sec
- tv_usec
- usec
- utc
- utc?
- utc_offset
- wday
- xmlschema
- yday
- year
- zone
- Class methods
- _load
- at
- gm
- httpdate
- local
- mktime
- new
- now
- parse
- rfc2822
- times
- utc
- w3cdtf
- xmlschema
- yaml_new
- zone_offset
- Private methods
-
apply_offset -
make_time -
month_days -
zone_utc? -
to_date -
to_datetime