Re: swatch internet time

From: Date: Sat, 22 Sep 2001 02:44:10 +0000
Subject: Re: swatch internet time
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-9461@lists.php.net to get a copy of this message
Hey all i worked it out. Someone emailed me the C code, I converted it to PHP here it is if any one else wants it. <?PHP $the_time = time(); $seta = ($the_time %86400); $setb = ($seta +3600); $setc = ($the_time -$setb); $setd = ($the_time -$setc); $sety = ($setd *10); $setz = ($sety /864); $beat = $setz; while($beat<0){ $beat += 1000; } $beat = $beat %1000; echo "@$beat"; ?> and the C code: beat = (((((long)the_time)-(((long)the_time) - ((((long)the_time) % 86400) + 3600))) * 10) / 864); while (beat < 0) { beat += 1000; } beat = beat % 1000; sprintf(tmp_buff, "%03d", beat); /* SAFE */ strcat(return_value->value.str.val, tmp_buff); break; the_time being the UNIX timestamp. Cheers All =)

« previous php.windows (#9461) next »