/*
* 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 */
tobj->gmt << 30 | /* 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);
}