subSecond example


    public function refresh()
    {
        $credential = $this->_credential;
        $credentialColumn = $this->_credentialColumn;
        $identity = $this->_identity;
        $identityColumn = $this->_identityColumn;
        $credentialTreatment = $this->_credentialTreatment;

        $expiry = Zend_Date::now()->subSecond($this->expiry);
        $this->setCredential($expiry);
        $this->setCredentialColumn($this->expiryColumn);

        $this->setIdentity($this->sessionId);
        $this->setIdentityColumn($this->sessionIdColumn);

        $result = parent::authenticate();

        $this->_credential = $credential;
        $this->_credentialColumn = $credentialColumn;
        $this->_identity = $identity;
        
        $max = pow(10, $this->_precision);
        // Milli includes seconds         if ($this->_fractional >= $max) {
            while ($this->_fractional >= $max) {
                $this->addSecond(1);
                $this->_fractional -= $max;
            }
        }

        if ($this->_fractional < 0) {
            while ($this->_fractional < 0) {
                $this->subSecond(1);
                $this->_fractional += $max;
            }
        }

        if ($this->_precision > strlen($this->_fractional)) {
            $this->_fractional = str_pad($this->_fractional, $this->_precision, '0', STR_PAD_LEFT);
        }

        return $this;
    }


    
Home | Imprint | This part of the site doesn't use cookies.