http://qs1969.pair.com?node_id=307818


in reply to Get Exact Time w/out Modules

So you have Perl, but no modules. I suspect that you will soon begin to conclude the Perl is a pain to program with. If you aren't going to be able to take advantage of the CPAN, then there seems to be very little sense in having Perl installed at all. It sounds to me like it would be much more to your advantage to program with a lower-level langauge, like C.

Replies are listed 'Best First'.
Re: Re: Get Exact Time w/out Modules
by mpeppler (Vicar) on Nov 17, 2003 at 21:52 UTC
    So you have Perl, but no modules. I suspect that you will soon begin to conclude the Perl is a pain to program with
    I'll have to disagree here - while CPAN is incredibly useful, you're still going to be much more productive coding in perl than in C even without access to it, and by using the syscall() built-in you can achieve pretty much anything that you need for low-level system functions. It's much more work than using various perl modules from CPAN, but it should get you there.

    Michael

Re: Re: Get Exact Time w/out Modules
by Anonymous Monk on Nov 17, 2003 at 21:49 UTC
    For the most part perl covers our needs wonderfully...cases like this are the exception. We don't have a C compiler either (they make you buy an SDK for that), so perl is more or less our only choice.
      If you don't have a C compiler, then you are going to have a hard time solving this problem. Presumably, the operating system has a function that give the time with a higher accuracy than the Perl builtin time(). Calling the C API from Perl requires an XS module compiled by a C compiler.

      The Time::HiRes module provides an interface to the gettimeofday function that will do the job. But you can't compile it because you don't have a C compiler. And can't install Perl modules.