Call us Toll-Free:
1-800-218-1525
Email us

 Sponsors

Swatch Beat Time

Code Wizard, 12-30-2006

Displays the current time in the Swatch .beat format where 24 hours = 1000 beats.

<?
/* returns the current time in */
/* swatch .beat format */
/* where 1000 beats = 24 hours */
/* Michael Hanney 1999, */
/* If you can think of a use for this */
/* please let me know. */
/* Example usage */
/* <? print(swatchbeats()); ?> */

function swatchbeats()
{
$offset = 60; /* bst */
$beat_division = 24 * 60 / 1000;
$current_date = getdate(time());
$hour = $current_date["hours"];
$minute = $current_date["minutes"];
$seconds = $current_date["seconds"];
$total_minutes = $minute + $offset + $hour * 60;
$beats = round ($total_minutes / $beat_division);
if ($beats >= 1000) /* hack, British Summer time */
{
$beats = $beats % 1000;
}
return ("@ ".$beats);
}
?>
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions