Path: utzoo!utgpu!watserv1!watmath!att!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!ncar!gatech!mcnc!uvaarpa!mmdf From: marc@athena.mit.edu (Marc Horowitz) Newsgroups: comp.lang.perl Subject: gettimeofday Message-ID: <1990Nov28.223128.14938@uvaarpa.Virginia.EDU> Date: 28 Nov 90 22:31:28 GMT Sender: mmdf@uvaarpa.Virginia.EDU (Uvaarpa Mail System) Reply-To: marc@mit.edu Organization: The Internet Lines: 27 |> "Spiffy" is one of the things some people (pas moi) don't like about perl. It's one of the things I like, too. Even if you don't make gettimeofday spiffy, it's still worthwhile, I think. |> I would say gettimeofday isn't there because it isn't on every system. |> Yes, Tom, I hear you say, but what about socket? Yes, there is that. |> But socket has to work with internal datatypes that you can't mock |> up very well just using syscall. You say using syscall is hard, but |> I would say having to know contextually dependent behavior is harder |> still. The gettimeofday syscall isn't on every system, but the functionality does exist (to some resolution < 1 sec) on almost every system I've seen (including the PC and Amiga). So implement a function, call it gettime if you don't like gettimeofday, which returns the time as a number of seconds (including fractional part) since the unix epoch. On non-unix systems, you may need to fudge by a constant factor. This is certainly more consistent, and more obvious, then using syscall on my unix box, and some other method on my pc. You could also implement gettimezone or something like that to get the time zone (this isn't implemented on all machines, though). One of the best things about perl is that it provides a uniform way of doing things across many heterogeneous platforms. syscall, although useful at times, does not keep this elegance. Marc