gettimeofday

array gettimeofday(void) 

Gets time information from the system.

Returns:

Array containing time information

Description:

This function acts as an interface to the UNIX system call gettimeofday(2).

Results from the function are returned as an associative array. The array contains the following keys:

Value Description
sec Seconds
usec Microseconds
minuteswest Minutes west of Greenwich
dsttime Type of Daylight Saving Time correction

Version:

PHP 3.0.7, PHP 4

See also:

getdate() 

Example:

Print the accurate UNIX epoch time
$my_time = gettimeofday(); 
print("At the tone the (very accurate) time will be: "); 
print("$my_time[sec].$my_time[usec]"); 

Get PHP Functions Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.