note 77583 deleted from ref.calendar by nlopess
| From: | nlopess@php.net | Date: | Wed, 05 Sep 2007 10:59:14 +0000 |
| Subject: | note 77583 deleted from ref.calendar by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-130205@lists.php.net to get a copy of this message | ||
Note Submitter: simon at chronolabs dot org dot au
----
Dear PHPers,
Here is the final post for RounCalendar, the couple of time before I tested the code and there was
an error in it negative time, the article for this calendar is found at http://time.chronolabs.org.au/roun-time-article.pdf.
I appologies to whomever maintains this section, next time I will properly test the code before
'adding a note'
Ounion movements is the most accurate calendar system as well as the most modern system of time,
developed by Simon Roberts to better understand systems of time, this calendar can be modified to
support deep space variables as well as quantum time annomolies:
<?php
$roun=RounCalendar(time(),10);
echo $roun['strout'];
//Function Rountime Calendar
function RounCalendar($unix_time, $gmt,
$poffset = '2008-05-11 10:05 AM',
$pweight = '-20.22222222223',
$defiency='deficient',
$timeset= array("hours" => 24,
"minutes" => 60,
"seconds"=> 60))
{
// Code Segment 1 â Calculate Floating Point
$tme = $unix_time;
if ($gmt>0){
$gmt=-$gmt;
} else {
$gmt=abs($gmt);
}
$ptime = strtotime($poffset)+(60*60*gmt);
$weight = $pweight+(1*gmt);
$roun_xa = ($tme)/(24*60*60);
$roun_ya = $ptime/(24*60*60);
$roun = (($roun_xa -$roun_ya) - $weight)+(microtime/999999);
// Code Segment 2 â Set month day arrays
$nonedeficient = array("seq1" => array(31,30,31,30,30,30,31,30,31,30,31,30),
"seq2" => array(31,30,31,30,31,30,31,30,31,30,31,30),
"seq3" => array(31,30,31,30,30,30,31,30,31,30,31,30),
"seq4" => array(31,30,31,30,30,30,31,30,31,30,31,30));
$deficient = array("seq1" => array(31,30,31,30,30,30,31,30,31,30,31,30),
"seq2" => array(31,30,31,30,31,30,31,30,31,30,31,30),
"seq3" => array(31,30,31,30,31,30,31,30,30,30,31,30),
"seq4" => array(30,30,31,30,31,30,31,30,31,30,31,30));
$monthusage = isset($defiency) ? ${$defiency} : $deficient;
// Code Segment 3 â Calculate month number, day number, day count etc
foreach($monthusage as $key => $item){
$i++;
foreach($item as $numdays){
$ttl_num=$ttl_num+$numdays;
$ttl_num_months++;
}
}
$revolutionsperyear = $ttl_num / $i;
$numyears = round((floor($roun) / $revolutionsperyear),0);
$avg_num_month = $ttl_num_months/$i;
$jtl = abs(abs($roun) - ceil($revolutionsperyear*($numyears+1)));
while($month==0){
$day=0;
foreach($monthusage as $key => $item){
$t++;
$u=0;
foreach($item as $numdays){
if ($ii<abs($roun)){
$isbelow=true;
}
$ii=$ii+$numdays;
if ($ii>abs($roun)){
$isabove=true;
}
if ($isbelow==true&&$isabove==true){
$daynum = floor(($ii-$numday)-abs($roun));
$month = $u;
if ($roun<0){
$month=floor($avg_num_month-$month);
$daynum=floor($numdays-$daynum);
} else {
$month++;
$daynum++;
}
$isbelow=false;
$isabove=false;
$nodaycount=true;
}
if ($nodaycount==false)
$day++;
$u++;
}
}
}
$timer = substr($roun, strpos($roun,'.')+1,strlen($roun)-strpos($roun,'.')-1);
$roun_out= $numyears.'-'.$month.'-'.$daynum.' '.$day.'.'.
floor(intval(substr($timer,0,2))/100*$timeset['hours']).':'.
floor(intval(substr($timer,2,2))/100*$timeset['minutes']).':'.
floor(intval(substr($timer,4,2))/100*$timeset['seconds']).'.'.
substr($timer,6,strlen($timer)-6);
$roun_obj = array('year'=>$numyears,'month'=>$month,
'day'=>$daynum,
'jtl'=>$jtl,
'day_count'=>$day,
'hours'=>floor(intval(substr($timer,0,2))/100*$timeset['hours']),
'minute'=> floor(intval(substr($timer,2,2))/100*$timeset['minutes']),
'seconds'=> floor(intval(substr($timer,4,2))/100*$timeset['seconds']),
'microtime'=>substr($timer,6,strlen($timer)-6),
'strout'=>$roun_out);
return $roun_obj;
}
?>