Skip to content

Latest commit

 

History

History
1170 lines (820 loc) · 37.3 KB

File metadata and controls

1170 lines (820 loc) · 37.3 KB

NAME

Time::HiRes - 蕭�膕上墾��� alarm, sleep, gettimeofday, ��ゃ�潟�帥�若����˨�帥�ゃ����

SYNOPSIS

use Time::HiRes qw( usleep ualarm gettimeofday tv_interval nanosleep
                      clock_gettime clock_getres clock_nanosleep clock
                    stat );

usleep ($microseconds);
nanosleep ($nanoseconds);

ualarm ($microseconds);
ualarm ($microseconds, $interval_microseconds);

$t0 = [gettimeofday];
($seconds, $microseconds) = gettimeofday;

$elapsed = tv_interval ( $t0, [$seconds, $microseconds]);
$elapsed = tv_interval ( $t0, [gettimeofday]);
$elapsed = tv_interval ( $t0 );

use Time::HiRes qw ( time alarm sleep );

$now_fractions = time;
sleep ($floating_seconds);
alarm ($floating_seconds);
alarm ($floating_seconds, $floating_interval);

use Time::HiRes qw( setitimer getitimer );

setitimer ($which, $floating_seconds, $floating_interval );
getitimer ($which);

use Time::HiRes qw( clock_gettime clock_getres clock_nanosleep
                      ITIMER_REAL ITIMER_VIRTUAL ITIMER_PROF ITIMER_REALPROF );

$realtime   = clock_gettime(CLOCK_REALTIME);
$resolution = clock_getres(CLOCK_REALTIME);

clock_nanosleep(CLOCK_REALTIME, 1.5e9);
clock_nanosleep(CLOCK_REALTIME, time()*1e9 + 10e9, TIMER_ABSTIME);

my $ticktock = clock();

use Time::HiRes qw( stat );

my @stat = stat("file");
my @stat = stat(FH);

DESCRIPTION

Time::HiRes ��≪�吾�ャ�若�˨�� usleep, nanosleep, ualarm, gettimeofday, setitimer/getitimer ��激�鴻�������潟�若�˨��荐��������������� 蕭�膕上墾��勖����祉����帥�ゃ����若�吾�� Perl ��ゃ�潟�帥�若����с�若�鴻��絎�茖������障����� 篏帥����鴻�˨�ゃ����⓾�壚��荐���� "EXAMPLES" 膀���������鴻����鴻�壔�ŝ�������� �����с����⓾�����������; ��冴�˨�ŝ�c�⓾����� nanosleep ������������ usleep, ualarm, gettimeofday, ��������� setitimer/getitimer ��˨�ゃ����⓾�壔�� ��激�鴻�������勖����吾�������с����⓾��������������

��激�鴻�������� gettimeofday() ��������勉�������ャ�㋘�若�激�с�潟����ŝ�������違�� gettimeofday() ���綣���遺����ゃ�勐就��с�� tv_interval() ��壚戎�����障�������� ��激�鴻�������� nanosleep(), usleep(), select(), poll �� ��í�������ŝ�������違��Time::HiRes::usleep(), Time::HiRes::nanosleep(), Time::HiRes::sleep() ��壚戎�����障�������� ��激�鴻�������� ualarm() ��� setitimer() ��勌検��鴻����ŝ�������違�� Time::HiRes::ualarm() ��� Time::HiRes::alarm() ��壚戎�����障��������

use �����勉�ŝ����у��茖���������⓾����ŝ����∽�違����ゃ�潟����若�������������������������� ��潟�潟����ゃ��������紊掩�������障�����

1 腱�篁ヤ����� sleep ��� usleep() ��с�壔�ŝ�� nanosleep() �� 絎�茖���������⓾�������違��nanosleep() ��壔�激�違����˨��篏帥����ŝ����勉�с�� 1 腱�篁ヤ����� sleep �����激�違����˨��羞桁����������������������с����障����� �����������������夌Щ罎���с��罨������障��; ��������⓾�障����������� nanosleep ��������c�⓾�������勉�����&Time::HiRes::d_nanosleep �� ��ゃ�������с�������������с����壔����ŝ�������違�ŝ����障�����; ��������������号����ŝ����������ŝ�������������� nanosleep() C API �����吾�� 茯㏍�障�ŝ�������違�ŝ����障��������

sleep �����激�違����˨��羞桁�����������篁ュ����勉�������� nanosleep ���篏帥�������� Perl ���������腱���勖③腆冴�����荀�羆����������篁�篋���勉�������˩戎�����鴻�������若�˨�с�������� ��������������������������障�����

Remember that unless you are working on a hard realtime system, any clocks and timers will be imprecise, especially so if you are working in a pre-emptive multiuser system. Understand the difference between wallclock time and process time (in UNIX-like systems the sum of user and system times). Any attempt to sleep for X seconds will most probably end up sleeping more than that, but don't be surpised if you end up sleeping slightly less. (TBT)

篁ヤ����勰�∽�違�������勉�≪�吾�ャ�若�˨�������ゃ�潟����若����с����障����� ��������í�˨����с����壔�鴻����若�������������∽�違�壔�������障��������

gettimeofday ()

��������潟�潟����㏍�鴻����с�壔����������壔�������勛����������ゃ�壔�㊦��篋���ゃ�勤��膣���勰��������菴������障����� ��鴻�˨�í�潟�潟����㏍�鴻����с�壔��Time::HiRes::time() ��勉�������̥����� 羌勐��絨���亥�号�違�ц�������障��(筝�荐�������)���

usleep ( $useconds )

���絎���������������ゃ�壔�㊦��(100 筝������� 1 腱�)��違��sleep �����障����� 絎������� sleep �����������ゃ�壔�㊦����違��菴������障����� usleep ��激�鴻�������潟�若�˨����奝��������1 腱�篁ヤ�� sleep �����������������с����障����� 0 腱���鴻�ŝ�若�������������������с����障��; �����違���� ��鴻�㋘�����紮�茘� (thread yield) ��勉����������������障����� Time::HiRes::usleep(), Time::HiRes::sleep(), Time::HiRes::clock_nanosleep() ������荀с��������������

usleep() ��� 1 �����ゃ�壔�㊦�����篏���ф③腆冴����喝�������ŝ����с��������������

nanosleep ( $nanoseconds )

Sleeps for the number of nanoseconds (1e9ths of a second) specified. Returns the number of nanoseconds actually slept (accurate only to microseconds, the nearest thousand of them). Can sleep for more than one second. Can also sleep for zero seconds, which often works like a thread yield. See also Time::HiRes::sleep(), Time::HiRes::usleep(), and Time::HiRes::clock_nanosleep(). (TBT)

nanosleep() ���������腱����篏���ф③腆冴����喝�������ŝ����с�������������� 1000 ������腱���勛仮綺⓾�с����壔����鴻�с�����

ualarm ( $useconds [, $interval_useconds ] )

ualarm ��潟�若�˨����肴�������障��; $interval_useconds ��壔�ŝ����激�с�潟�с�� ���絎���������ŝ�������� 0 ��˨�ŝ����������勛�������� alarm ��勉�������ɱ�������������障�����

��≪�í�若����勖�������������������ゃ�壔�㊦����ц�������障��; �����í�若����榊���������� undef ���菴������障�����

ualarm(0) ��壩�ɱ��茵���� ualarm() �����㏍�c�潟�祉�˨����障�����

��≪�í�若�������鴻�ŝ�若����勛�娯��篏������壩�ʃ�鎘���с��������������羈���������⓾��������������

tv_interval

tv_interval ( $ref_to_gettimeofday [, $ref_to_later_gettimeofday] )

篋���ゃ�勖����祉�勖��������羌勐��絨���亥�鴻�勛����違��菴������障����� 篋���ゃ�勖����祉�� gettimeofday() ��ц����������������勉�с�ŝ�������違�ŝ����障�������� 2 ��ɾ�勉�勐����違�������ャ���������������憜����勖����祉��篏帥�������障�����

time ()

羌勐��絨���亥�鴻�с����������壔�������勛����違��菴������障����� �����勰�∽�違�壔�ゃ�潟����若�������������������с����障��; �����勛��������Perl ��勉�潟�≪�ф��箴���������� 綏勉��莨若�水����� time ���臀勉�������������������˨�ŝ����障��; 筝�荐���� "EXAMPLES" ������荀с��������������

羈���� 1: �����勰��膕上墾��� time ��壔�������ŝ����勉����í����������若�������潟�≪�� time() ��� 緇������������˨��������蕭�膕上墾��勖����祉��������筝������������������������⓾��������筝���ʃ�����腱��� ��������勉�������������˨����c�⓾����潟�≪�� time() ���������紊������c��������絨���ŝ����c����� �����������������������障��; ���������綵���吟�������勐勲��� 0.5 腱����莇���������������壔����������障�������� ��激�鴻�������у�ñ���櫝�純�ŝ�����"clock_getres" ��������с����⓾��������������

羈���� 2: 2001 綛� 9 ��� 9 ��� ��ユ����� GMT ��勐����� 1:46:40 ��������� �����������壔�������� time() 腱���壔��1_000_000_000 ���莇������⓾����障����� Perl ��с�勉�������í�˨����勖貴���絨���亥�鴻�勉����í�若����������������������壔�������勛����違�� ��������障�c�〠����������ŝ����違��篏������冴����障��: Time::HiRes::time() ��勐�ゃ�� ��阪��������������篆�荐若�������� 6 罅�(�����ゃ�壔�㊦��)��с�壔�ŝ�� 5 罅���勖�医��������緇������������� ��с����障�������� ���綽������ŝ��; �����ゃ�壔�㊦����壠����������障��(�����<����������ŝ���� �����í����������若�������������勉�������ɾ��綺⓾����泣����若�������⓾����������勉����喝�������⓾����障��)��� 篏����莎激����⓾�������������������違��Perl ��勖貴���絨���亥�鴻�勉�������í�˨����勉����í�若����������с� 15 罅���勖�医����������阪�������障�������� �����勐�翫�����絨���亥�鴻�勐����� 10 罅���勖�医�������������������勐�������� 5 罅���������障����� �����ゃ�壔�㊦�����荀������������˨�� "%.6f" ��� printf/sprintf �� ��í�<��������篏帥����������ŝ�鴻����潟�潟����㏍�鴻����� gettimeofday() ��� 篏帥�������������с����障����� �����勐�翫����˨�壔��腱���������ゃ�壔�㊦����勌����ゃ����ャ�勐�ゃ�������☖�������⓾�������障�����

sleep ( $floating_seconds )

���絎����������腱���違��sleep �����障����� 絎������� sleep ������腱���違��(羌勐��絨���亥�鴻�勐�ゃ��)菴������障����� �����勰�∽�違�壔�ゃ�潟����若�������������������с����障��; �����勛��������Perl ��勉�潟�≪�ф��箴����������綏勉��莨若�水����� sleep ��� 臀勉�������������������˨�ŝ����障��; 筝�荐���� "EXAMPLES" ������荀с��������������

��≪�í�若�������鴻�ŝ�若����勛�娯��篏������壩�ʃ�鎘���с��������������羈���������⓾��������������

alarm ( $floating_seconds [, $interval_floating_seconds ] )

���絎�������腱���医�����SIGALRM ��激�違����˨�������������障����� setitimer() �����������違��������篏帥�������ŝ�������� ualarm() ���篏帥�c� 絎�茖���������⓾����障����� $interval_floating_seconds 綣���違� ��ŝ����激�с�潟�ф��絎���������ŝ����� 0 ��˨�ŝ����障����� �����勛��������alarm() ��勉�������ɱ�������˨�ŝ����障����� �����勰�∽�違�壔�ゃ�潟����若�������������������с����障��; �����勛��������Perl ��勉�潟�≪�ф��箴����������綏勉��莨若�水����� alarm ��� 臀勉�������������������˨�ŝ����障��; 筝�荐���� "EXAMPLES" ������荀с��������������

��≪�í�若����勖��������������腱���ц�������障��; �����í�若����榊����������翫���� undef ���菴������障�����

羈���� 1: ��ŝ����㋘�若����c�潟�違�激�鴻�������� Perl ��勉�ŝ�ŝ�若�鴻� 腟���水����������˨����c�⓾�� SIGALRM ���筝㊥�㏍����������勉�с�壔�ŝ�����select() ��� ������紮���������������������������障����� ��������� alarm() ��勐����� select() ���������������alarm() ������絎������� ��������������˨�с�壔�ŝ����� alarm() ��� select() ������絎������������������勐��荐������������������� ��������ŝ����������������潟����障�����

��≪�í�若�������鴻�ŝ�若����勛�娯��篏������壩�ʃ�鎘���с��������������羈���������⓾��������������

setitimer ( $which, $floating_seconds [, $interval_floating_seconds ] )

��ゃ�潟�帥�若����˨�帥�ゃ����若�����紮���������障��; 筝�絎���勖�����緇������激�違����� ($which) ���絮������� ��������������с�激�違����˨��絮����膓���������������������障�������� "itimer" ���罩≪�������˨�壔��$floating_seconds ��� 0 ��˨����⓾�������������� $interval_floating_seconds ��� 0 ������絎�������������(�����������壚����� ���絎���������ŝ�����)�����帥�ゃ����若�壩❶��˨�激�違����˨��絮������� 緇���� 罩≪����������障�����

��ゃ�潟�帥�若����˨�帥�ゃ����若��篏帥����������� alarm(), sleep()���usleep() �� �����c�☁�ʒ�������������������������障�������� 罔�羣������˨�壔����娯��篏������虁�鎘���������⓾����障��������; ��ゃ�障����� 篏���с�� 莎激����������障��: ��������������������障����������� ��������с�ŝ����������������障��������

��鴻�˨�í�潟�潟����㏍�鴻����с�壔�帥�ゃ����若�с�勖��������������菴���������障�����

��ŝ�鴻����潟�潟����㏍�鴻����с�壔��罧���������������ゃ�潟�帥�若����˨��菴���������障�����

���絽娯����ゃ����������壠����ゃ�勉�ゃ�潟�帥�若����˨�帥�ゃ�����(��激�違�����)�����ñ���櫝�純�с��: $which ��� ITIMER_REAL, ITIMER_VIRTUAL, ITIMER_PROF, ITIMER_REALPROF ��˨����������������с����障����� ��í�������ñ����с����������壚札筝���勉�������˩��絖������障��: ��㋚����� UNIX �����í����������若����奝��絽御�������勌����ゃ�������c�⓾����障����� ��������� Solaris ��� ITIMER_REALPROF ��������c�⓾�������������с�� (��������壔����˨����鴻�㋘�������ŝ����㏍�違�í����������㏍����<�ゃ�˨�������������˩戎��������障��)��� Win32 ��壩��綽泣�ŝ�������ゃ�潟�帥�若����˨�帥�ゃ����若�������c�⓾����障��������

ITIMER_REAL ��夌�������������� alarm() ��勉�������ɱ�������˨����障����� ���������絎�������; ��ゃ�障��紕����荐���勖�������ц����������障����� ��帥�ゃ����若����������������˨�ŝ����� SIGALRM ��������������障�����

ITIMER_VIRTUAL ���(�����㏍�祉��)篁勖�潟�勖����� ��ф��������荐������障��鐚� ��ゃ�障�������㏍�祉�鴻��絎�茵������⓾�������������������с����� �����˨�������㏍�祉�����/��⓾�若��/CPU ��勉�激�鴻�������с�壔������� 絎������������������壠�����荐���勖����������壠�������c��������絨���ŝ����c����������障����� (�����勖�������� ��⓾�若�吟�惹�����(user time) ��������若�違����障����� ��帥�ゃ����若����������������˨�ŝ����� SIGVTALRM ��������������障�����

ITIMER_PROF ��壔����㏍�祉�剛皿��恰��������������������(I/O ��勉��������)�����㏍�祉�鴻�勌������������� ��ŝ����㋘�若����c�潟�違�激�鴻��������莎違�c�⓾��������������荐������障����� (�����勖�������� ��激�鴻�����������(system time) ��������若�違����障�����) ��帥�ゃ����若����������������˨�ŝ��������SIGPROF ��������������障����� SIGPROF ��壔�激�鴻�������潟�若�˨��筝㊥�㏍�������������������с����障�����

�����˨����鴻�㋘�������ŝ����㏍�違�í����с�勉�ゃ�潟�帥�若����˨�帥�ゃ����若�勖����潟� ��激�鴻�������˨�������障����� ��������⓾�激�鴻�������˨����c�⓾�壔����������˩����勉�ゃ�潟�帥�若����˨�帥�ゃ����若�� ��泣����若�������⓾�������������������障�������� 箴������違����鴻�㋘����������í�勉�鴻�㋘����������激�違����˨�����篆<����������壩�ʃ�鎘���с����� �����ŝ����� setitimer() ��勉����㏍�ャ�<�潟��������荀с��������������

getitimer ( $which )

$which ��ф��絎������������ゃ�潟�帥�若����˨�帥�ゃ����若�с�勖��������������菴������障�����

��鴻�˨�í�潟�潟����㏍�鴻����с�壔��罧�������������菴���������障�����

��ŝ�鴻����潟�潟����㏍�鴻����с�壩����������������ゃ�潟�帥�若����˨�勌検��鴻��菴���������障����� ��ゃ�潟�帥�若����˨�壠幻��˨��setitimer() ���篏帥�c�������������ャ����������勉�с�����

clock_gettime ( $which )

$which ��ф��絎���������� POSIX 蕭�膕上墾��帥�ゃ����若�勛憜����勐�ゃ�� 腱����篏���ц�������障����� POSIX 蕭�膕上墾��帥�ゃ����若��絲上�������⓾����������⓾�勐��茖���壔��絨���ŝ�������� $which ��勐�ゃ�������� CLOCK_REALTIME ���絲上�������⓾�������������� ��喝����������障��: �����勐�翫�����gettimeofday ��勛����������ゃ�障�� ��違�ŝ�������御��羣����(GMT)��� 1970 綛� 1 ��� 1 �� 00:00:00:00 ��������勛����違�̬�����腟�������菴���������������喝����������障����� Do not assume that CLOCK_REALTIME is zero, it might be one, or something else. Another potentially useful (but not available everywhere) value is CLOCK_MONOTONIC, which guarantees a monotonically increasing time value (unlike time() or gettimeofday(), which can be adjusted). See your system documentation for other possibly supported values. (TBT)

clock_getres ( $which )

Return as seconds the resolution of the POSIX high resolution timer specified by $which. All implementations that support POSIX high resolution timers are supposed to support at least the $which value of CLOCK_REALTIME, see "clock_gettime". (TBT)

clock_nanosleep ( $which, $nanoseconds, $flags = 0)

Sleeps for the number of nanoseconds (1e9ths of a second) specified. Returns the number of nanoseconds actually slept. The $which is the "clock id", as with clock_gettime() and clock_getres(). The flags default to zero but TIMER_ABSTIME can specified (must be exported explicitly) which means that $nanoseconds is not a time interval (as is the default) but instead an absolute time. Can sleep for more than one second. Can also sleep for zero seconds, which often works like a thread yield. See also Time::HiRes::sleep(), Time::HiRes::usleep(), and Time::HiRes::nanosleep(). (TBT)

clock_nanosleep() ���������腱����篏���ф③腆冴����喝�������ŝ����с�������������� 1000 ������腱���勛仮綺⓾�с����壔����鴻�с�����

clock()

Return as seconds the process time (user + system time) spent by the process since the first call to clock() (the definition is not "since the start of the process", though if you are lucky these times may be quite close to each other, depending on the system). What this means is that you probably need to store the result of your first call to clock(), and subtract that value from the following results of clock(). (TBT)

The time returned also includes the process times of the terminated child processes for which wait() has been executed. This value is somewhat like the second value returned by the times() of core Perl, but not necessarily identical. Note that due to backward compatibility limitations the returned value may wrap around at about 2147 seconds or at about 36 minutes. (TBT)

stat
stat FH
stat EXPR

As "stat" in perlfunc but with the access/modify/change file timestamps in subsecond resolution, if the operating system and the filesystem both support such timestamps. To override the standard stat(): (TBT)

use Time::HiRes qw(stat);

Test for the value of &Time::HiRes::d_hires_stat to find out whether the operating system supports subsecond file timestamps: a value larger than zero means yes. There are unfortunately no easy ways to find out whether the filesystem supports such timestamps. UNIX filesystems often do; NTFS does; FAT doesn't (FAT timestamp granularity is two seconds). (TBT)

A zero return value of &Time::HiRes::d_hires_stat means that Time::HiRes::stat is a no-op passthrough for CORE::stat(), and therefore the timestamps will stay integers. The same thing will happen if the filesystem does not do subsecond timestamps, even if the &Time::HiRes::d_hires_stat is non-zero. (TBT)

In any case do not expect nanosecond resolution, or even a microsecond resolution. Also note that the modify/access timestamps might have different resolutions, and that they need not be synchronized, e.g. if the operations are (TBT)

write
stat # t1
read
stat # t2

t2 ��≪�壔�祉�号����祉�壔��t1 ��勐����贋����祉�����紊с�����綽�荀���壔�������障�����: ��������壠����������c����� 絨������� ��翫�������������障�����

EXAMPLES

(箴�)

use Time::HiRes qw(usleep ualarm gettimeofday tv_interval);

$microseconds = 750_000;
usleep($microseconds);
# 2.5 腱�緇���������勐����� 0.1 腱���������˨�激�違����˨�≪�í�若��
ualarm(2_500_000, 100_000);
# ������ ualarm �����㏍�c�潟�祉�
ualarm(0);
# �����������壔�������勛����������ゃ�壔�㊦��������緇�
($s, $usec) = gettimeofday();
# 腟������������勤��羝
# (篋���ゃ�� gettimeofday ��勖�祉����ゃ��綣������������˨����c�⓾���櫝�純�с��)
$t0 = [gettimeofday];
# ��������т�������☎����勐�冴�障�����絎�茵�
$t1 = [gettimeofday];
# �����������☎����勐�冴�障�����絎�茵�
$t0_t1 = tv_interval $t0, $t1;

$elapsed = tv_interval ($t0, [gettimeofday]);
$elapsed = tv_interval ($t0);   # equivalent code
#
# time, alarm , sleep ���羌勐��絨���亥�鴻�с�勛��������������
# �����勉�х舟���������
#
use Time::HiRes;
$now_fractions = Time::HiRes::time;
Time::HiRes::sleep (2.5);
Time::HiRes::alarm (10.6666666);

use Time::HiRes qw ( time alarm sleep );
$now_fractions = time;
sleep (2.5);
alarm (10.6666666);
# �����㏍�祉�剛皿��恰�������ф�������� 10 腱���������勐����� 2.5 腱���������
# �����c�⓾�������ゃ�潟�帥�若����˨�帥�ゃ����若��茖����������

use Time::HiRes qw ( setitimer ITIMER_VIRTUAL time );

$SIG{VTALRM} = sub { print time, "\n" };
setitimer(ITIMER_VIRTUAL, 10, 2.5);

use Time::HiRes qw( clock_gettime clock_getres CLOCK_REALTIME );
# Read the POSIX high resolution timer.
my $high = clock_getres(CLOCK_REALTIME);
# But how accurate we can be, really?
my $reso = clock_getres(CLOCK_REALTIME);

use Time::HiRes qw( clock_nanosleep TIMER_ABSTIME );
clock_nanosleep(CLOCK_REALTIME, 1e6);
clock_nanosleep(CLOCK_REALTIME, 2e9, TIMER_ABSTIME);

use Time::HiRes qw( clock );
my $clock0 = clock();
... # Do something.
my $clock1 = clock();
my $clockd = $clock1 - $clock0;

use Time::HiRes qw( stat );
my ($atime, $mtime, $ctime) = (stat("istics"))[8, 9, 10];

C API

��≦宍�����吾�鋋冴�˨�壚��荐���� perl API �����������⓾��C API �����ñ����с����障����� 篁ヤ����� C ��勰�∽�違�� modglobal ��������激�ャ�у�ñ����с����障��:

��∽�医��           C�����㏍����帥�ゃ��
---------------  ----------------------
Time::NVtime     double (*)()
Time::U2time     void (*)(pTHX_ UV ret[2])

��∽�違�壚検��鴻�����(gettimeofday ��勉��������)�����������宴��菴������障����� ��������������勤;�憗����������障�����NVtime ��� U2time �����������������壚源�� ��ŝ����㋘�若����c�潟�違�激�鴻�������˩��絖������⓾����ŝ����������̹�御����������⓾����障����� (Win32 ��� VMS ��勉�������˨�������ゃ����勉����í����������若����с�壔����勉�������ャ�㋘�若�激�с�潟�� ��������⓾����障��������gettimeofday ��� Unix 筝㊤�������с�����)

C ������ NVtime ���篏帥�c����������勌�����篁ヤ����̥ず�����障��:

double (*myNVtime)(); /* Returns -1 on failure. */
SV **svp = hv_fetch(PL_modglobal, "Time::NVtime", 12, 0);
if (!svp)         croak("Time::HiRes is required");
if (!SvIOK(*svp)) croak("Time::NVtime isn't a function pointer");
myNVtime = INT2PTR(double(*)(), SvIV(*svp));
printf("The current time is: %f\n", (*myNVtime)());

DIAGNOSTICS

useconds or interval more than ...

In ualarm() you tried to use number of microseconds or interval (also in microseconds) more than 1_000_000 and setitimer() is not available in your system to emulate that case. (TBT)

negative time not invented yet

綣���違�������⓾����ゃ����鴻�勖����祉��篏帥�������������障��������

internal error: useconds < 0 (unsigned ... signed ...)

篏������蚊�í�����絎潟����������障����� -- �����ゃ����鴻�˨�ŝ����壔����勉�ŝ�������ゃ�壔�㊦����違� �����ゃ����鴻�˨�ŝ�c�⓾����障����障�������� ��潟�潟����ゃ�í��紕������⓾�������勉�����?

useconds or uinterval equal to or more than 1000000

筝������勉����í����������í�若����с�壔��1 腱���ʋ����勤В��鎺⓾�� 1 腱����莇���������激���� ��≪�í�若�����篏帥����障��������

unimplemented in this platform

筝������勐�若�喝�冴����壔��絎���í����������ャ�㋘�若�激�с�潟����̹�≪����������������⓾� �����í����������í�若����у�ñ���櫝�純����������������с�壔�������障��������

CAVEATS

��潟�≪�� time() ��������������⓾����勉�с�壔�ŝ�����������篋���ャ�������������������ŝ���������� 羈���������⓾�������������� ��������壔�潟�≪�� time() ��� gettimeofday() ��� Time::HiRes::time() ���������1腱������������������怨����������������������ŝ����������� ��������������潟����障�����

(��������障����� ntp ��勉�������ŝ�泣�若����鴻�˨����c��) ��激�鴻�������壔�㏍����壔��篆勖③��������������壔�� ��鴻�������祉�����茯水��������������������篁勐����������傑��������篏������⓾����������㏍�違�í����с�壔�� ��馹����綣����莎激�������������������障����� (�����⓾�勉����í����������í�若��������Unix ��� ntp ��� ���������������緇������������祉��篆勖③��������������с�壔�ŝ�����������羈���������⓾�����������)��� 箴������違��Win32 (��������� Cygwin ��� MinGW ��勉�������ʋ款��������í����������í�若��) ��с�壔�� Time::HiRes::time() ��壔�激�鴻�������壔�㏍����� (��������喝����� time()) ������ 筝�������������紊� 0.5 腱���������������������������障����� Time::HiRes ��壩��腟������˨�壔��������羂�篁������☗��茯炊�眼����障����� Time::HiRes 1.77 篁ラ����с�� clock_gettime(CLOCK_MONOTONIC) ����������� ��í����˨�ŝ����������������障����� (��激�鴻�������� CLOCK_MONOTONIC ���絲上�������⓾�������翫��)���

筝������勉�激�鴻�������� API ��������c�⓾����障�����絎�茖���������⓾����障�����: 箴������� QNX ��� Haiku ��壔�ゃ�潟�帥�若����˨�帥�ゃ����� API ��������c�⓾����障�������� ���篏������障��������

SEE ALSO

Perl ��≪�吾�ャ�若�� BSD::Resource, Time::TAI64���

��激�鴻�������� clock, clock_gettime, clock_getres, clock_nanosleep, clock_settime, getitimer, gettimeofday, setitimer, sleep, stat, ualarm ��勖����吾��

AUTHORS

D. Wegscheid <wegscd@whirlpool.com> R. Schertler <roderick@argon.org> J. Hietaniemi <jhi@iki.fi> G. Aas <gisle@aas.no>

COPYRIGHT AND LICENSE

Copyright (c) 1996-2002 Douglas E. Wegscheid. All rights reserved.

Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Jarkko Hietaniemi. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.