[% setvar title Higher resolution time values %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

Higher resolution time values

VERSION

  Maintainer: Gisle Aas <gisle@ActiveState.com>
  Date: 2 Aug 2000
  Mailing List: perl6-language@perl.org
  Number: 7
  Version: 1
  Status: Developing

ABSTRACT

All functions that return time values (seconds since epoch) should use floating point numbers to return as much precision as the platform supports. All functions that take time values as arguments should work for fractional seconds if the platform supports it.

DESCRIPTION

Perl5 only support 1 second resolution on time values. In order to get higher resolution timing an external module (Time::HiRes) currently need to be used. This situation ought to be improved in perl6.

All functions that return time values (seconds since epoch) should use floating point numbers to return as much precision as the platform supports. This include the following builtin functions:

  time
  stat    /* atime, mtime and ctime fields */
  times   /* already float */

All functions that take time values as arguments should work for fractional seconds if the platform supports it. This include the following builtin functions:

  sleep
  alarm
  utime

One problem with using doubles to represent time values is that it will not always be able to represent all of the time precision that the platform actually support. For instance time() value with Unix epoch represented with 15 decimal digit float precision will only support around 10 µs resolution for current timestamps.

IMPLEMENTATION

Should be straight forward. Configure might need to figure out some more about what hires-timer interfaces are available if it does not already do this.

PERL5 PORTABILITY

Calls to time() could be transformed to int(time()) when converting perl5 programs to perl6.

REFERENCES

Time::HiRes module on CPAN