Snippet Name: Get Atomic time Description: This returns the time in the form of a timestamp. Comment: (none) Language: PHP Highlight Mode: PHP Last Modified: March 01st, 2009
Description: This returns the time in the form of a timestamp.
<?PHP $fp = FSOCKOPEN("time-a.nist.gov", 37); IF ($fp) { FPUTS($fp, "\n"); $timevalue = FREAD($fp, 49); FCLOSE($fp); } $atomic_time = (ABS(HEXDEC('7fffffff') - HEXDEC(BIN2HEX($timevalue)) - HEXDEC('7fffffff')) - 2208988800); ECHO $atomic_time; ?>