File indexing completed on 2024-12-22 05:36:52

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category  Zend
0016  * @package   Zend_Measure
0017  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0018  * @license   http://framework.zend.com/license/new-bsd     New BSD License
0019  * @version   $Id$
0020  */
0021 
0022 /**
0023  * Implement needed classes
0024  */
0025 // require_once 'Zend/Measure/Abstract.php';
0026 // require_once 'Zend/Locale.php';
0027 
0028 /**
0029  * Class for handling time conversions
0030  *
0031  * @category   Zend
0032  * @package    Zend_Measure
0033  * @subpackage Zend_Measure_Time
0034  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0035  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0036  */
0037 class Zend_Measure_Time extends Zend_Measure_Abstract
0038 {
0039     const STANDARD = 'SECOND';
0040 
0041     const ANOMALISTIC_YEAR  = 'ANOMALISTIC_YEAR';
0042     const ATTOSECOND        = 'ATTOSECOND';
0043     const CENTURY           = 'CENTURY';
0044     const DAY               = 'DAY';
0045     const DECADE            = 'DECADE';
0046     const DRACONIC_YEAR     = 'DRACONTIC_YEAR';
0047     const EXASECOND         = 'EXASECOND';
0048     const FEMTOSECOND       = 'FEMTOSECOND';
0049     const FORTNIGHT         = 'FORTNIGHT';
0050     const GAUSSIAN_YEAR     = 'GAUSSIAN_YEAR';
0051     const GIGASECOND        = 'GIGASECOND';
0052     const GREGORIAN_YEAR    = 'GREGORIAN_YEAR';
0053     const HOUR              = 'HOUR';
0054     const JULIAN_YEAR       = 'JULIAN_YEAR';
0055     const KILOSECOND        = 'KILOSECOND';
0056     const LEAPYEAR          = 'LEAPYEAR';
0057     const MEGASECOND        = 'MEGASECOND';
0058     const MICROSECOND       = 'MICROSECOND';
0059     const MILLENIUM         = 'MILLENIUM';
0060     const MILLISECOND       = 'MILLISECOND';
0061     const MINUTE            = 'MINUTE';
0062     const MONTH             = 'MONTH';
0063     const NANOSECOND        = 'NANOSECOND';
0064     const PETASECOND        = 'PETASECOND';
0065     const PICOSECOND        = 'PICOSECOND';
0066     const QUARTER           = 'QUARTER';
0067     const SECOND            = 'SECOND';
0068     const SHAKE             = 'SHAKE';
0069     const SIDEREAL_YEAR     = 'SYNODIC_MONTH';
0070     const TERASECOND        = 'TERASECOND';
0071     const TROPICAL_YEAR     = 'TROPIC_YEAR';
0072     const WEEK              = 'WEEK';
0073     const YEAR              = 'YEAR';
0074 
0075     /**
0076      * Calculations for all time units
0077      *
0078      * @var array
0079      */
0080     protected $_units = array(
0081         'ANOMALISTIC_YEAR'  => array('31558432', 'anomalistic year'),
0082         'ATTOSECOND'        => array('1.0e-18', 'as'),
0083         'CENTURY'           => array('3153600000', 'century'),
0084         'DAY'               => array('86400', 'day'),
0085         'DECADE'            => array('315360000', 'decade'),
0086         'DRACONIC_YEAR'     => array('29947974', 'draconic year'),
0087         'EXASECOND'         => array('1.0e+18', 'Es'),
0088         'FEMTOSECOND'       => array('1.0e-15', 'fs'),
0089         'FORTNIGHT'         => array('1209600', 'fortnight'),
0090         'GAUSSIAN_YEAR'     => array('31558196', 'gaussian year'),
0091         'GIGASECOND'        => array('1.0e+9', 'Gs'),
0092         'GREAT_YEAR'        => array(array('*' => '31536000', '*' => '25700'), 'great year'),
0093         'GREGORIAN_YEAR'    => array('31536000', 'year'),
0094         'HOUR'              => array('3600', 'h'),
0095         'JULIAN_YEAR'       => array('31557600', 'a'),
0096         'KILOSECOND'        => array('1000', 'ks'),
0097         'LEAPYEAR'          => array('31622400', 'year'),
0098         'MEGASECOND'        => array('1000000', 'Ms'),
0099         'MICROSECOND'       => array('0.000001', 'µs'),
0100         'MILLENIUM'         => array('31536000000', 'millenium'),
0101         'MILLISECOND'       => array('0.001', 'ms'),
0102         'MINUTE'            => array('60', 'min'),
0103         'MONTH'             => array('2628600', 'month'),
0104         'NANOSECOND'        => array('1.0e-9', 'ns'),
0105         'PETASECOND'        => array('1.0e+15', 'Ps'),
0106         'PICOSECOND'        => array('1.0e-12', 'ps'),
0107         'QUARTER'           => array('7884000', 'quarter'),
0108         'SECOND'            => array('1', 's'),
0109         'SHAKE'             => array('1.0e-9', 'shake'),
0110         'SIDEREAL_YEAR'     => array('31558149.7676', 'sidereal year'),
0111         'TERASECOND'        => array('1.0e+12', 'Ts'),
0112         'TROPICAL_YEAR'     => array('31556925', 'tropical year'),
0113         'WEEK'              => array('604800', 'week'),
0114         'YEAR'              => array('31536000', 'year'),
0115         'STANDARD'          => 'SECOND'
0116     );
0117 }