[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl & timelocal....



wls@oculus.jsei.ucla.edu writes:
}Help!!
}
}I can't get timelocal to work on my mac(s)
}It works on on my sun.

Doesn't look like it.  In fact, it looks like your Sun is wrong.

}It's the very recent download... system 7.5.5 mac IIfx & more...
}
}here's my test:
}
}#!/home/johnh/BIN/perl5 -w
}
}require "timelocal.pl";
}
}# prints :
}# raw local time is 03/07/1997 13:12:24 5 65 0
}# timelocal = ffffffff

All 1 bits?

}# ... on my mac.
}# prints :
}# printf (...) interpreted as function at timelocal.pl line 8.
}# raw local time is 03/07/1997 13:13:18 5 65 0
}# timelocal = 332084ee
}# ... on my sun
}
}
} @timearray = localtime(time);
} ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = @timearray;
} printf ("raw local time is %02d/%02d/%04d %02d:%02d:%02d %d %d %d\n",
}          $mon+1,$mday,1900+$year,$hour,$min,$sec,$wday,$yday,$isdst);
} $ltime = &timelocal(@timearray);
} printf ("timelocal = %8x\n",$ltime);

Here's what I get under MacPerl:

raw local time is 03/07/1997 17:05:18 5 65 0
timelocal = af45a6ee

and on my Sun (Perl 5.003, SunOS 4.1.4)

raw local time is 03/07/1997 17:07:46 5 65 0
timelocal = 332091b2

I haven't checked to see whether the hex is right, but it should be on both.

I don't know exactly what you're expecting.  Looks to me like Perl on your
Sun may be messed up; notice the message about printf.  You do realize that
the Unix and Mac zeroes of time are different, so the last hex numbers will
differ substantially?


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us