NAME

BSD::Time - BSD gettimeofday, settimeofday functions

SYNOPSIS

use BSD::Time;

# gettimeofday

$time = gettimeofday();

($time, $minuteswest, $dsttype) = gettimeofday();

# settimeofday

$success = settimeofday($time, $minuteswest, $dsttime);

DESCRIPTION

gettimeofday

$time = gettimeofday();

In scalar context gettimeofday returns the number of seconds since the midnight (0 hour), January 1, 1970 UTC (Coordinated Universal Time, formerly known as Greenwich Mean Time, GMT). This is identical to the usual Perl time() function except that also the subsecond fractional is returned. The accuracy is nominally one microsecond, one millionth of a second, but normally the accuracy is lower than that, maybe few dozen microseconds.

($seconds, $microseconds, $minuteswest, $dsttype) = gettimeofday();

In list context gettimeofday returns the seconds and microseconds and the timezone information: the minutes west of the Greenwich Meridian and the Daylight Savings Time Type. The type is a system-dependent integer value that is not actually much of use these days: it a historical relic.

settimeofday

$success = settimeofday($seconds, $microseconds,
			$minuteswest, $dsttime);

settimeofday sets the time, the arguments being as in the list context of gettimeofday. settimeofday may be used only by the superuser. It returns true if setting succeeded, false if not.

LIMITATIONS

The time accuracy is nominally one microsecond, one millionth of a second, but the implementation of your environment may not be that accurate.

The BSD time-adjusting function adjtime() is not implemented. This may affect in some environment the settimeofday() in such a way that setting time time with subsecond accuracy is not possible.

AUTHOR

Jarkko Hietaniemi <jhi@iki.fi>