Php gets reliable and accurate current time (via time server. From: justcoding. iteye. comblog843645 returned field Description: www. nist. Without. cfm $ fpfsockopen (time.nist.gov, 13, $ errno, $ errstr, 90); $ ufcexplode (, fread
Php gets reliable and accurate current time (via time server. From: http://justcoding.iteye.com/blog/843645 return field Description: http://www.nist.gov/pml/p688/grp40/its.cfm no $ fp = fsockopen ('time .nist.gov ', 13, $ errno, $ errstr, 90); $ ufc = explode ('', fread
Php gets reliable and accurate current time (via time server. From: http://justcoding.iteye.com/blog/843645
Returned field Description: http://www.nist.gov/pml/p688/grp40/its.cfm <无>
$ Fp = fsockopen ('time .nist.gov ', 13, $ errno, $ errstr, 90); $ ufc = explode ('', fread ($ fp, date ('y'); $ date = explode ('-', $ ufc [1]); $ processdate = $ date [1]. '-'. $ date [2]. '-'. date ('y '). ''. $ ufc [2]; switch ($ ufc [5]) {case 0: echo 'exact '; break; case 1: echo 'error: 0-5s'; break; case 2: echo 'error:> 5s '; break; default: echo 'hardware error! '; Break;} echo gmttolocal ($ processdate, 8); // China function gmttolocal ($ mydate, $ mydifference) {$ datetime = explode ("", $ mydate ); $ dateexplode = explode ("-", $ datetime [0]); $ timeexplode = explode (":", $ datetime [1]); $ unixdatetime = mktime ($ timeexplode [0] + $ mydifference, $ timeexplode [1], 0, $ dateexplode [0], $ dateexplode [1], $ dateexplode [2]); return date ("m/d/y h: I: s", $ unixdatetime );}