Time.php
4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Measure
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Time.php 23775 2011-03-01 17:25:24Z ralph $
*/
/**
* Implement needed classes
*/
require_once 'Zend/Measure/Abstract.php';
require_once 'Zend/Locale.php';
/**
* Class for handling time conversions
*
* @category Zend
* @package Zend_Measure
* @subpackage Zend_Measure_Time
* @copyright Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Measure_Time extends Zend_Measure_Abstract
{
const STANDARD = 'SECOND';
const ANOMALISTIC_YEAR = 'ANOMALISTIC_YEAR';
const ATTOSECOND = 'ATTOSECOND';
const CENTURY = 'CENTURY';
const DAY = 'DAY';
const DECADE = 'DECADE';
const DRACONIC_YEAR = 'DRACONTIC_YEAR';
const EXASECOND = 'EXASECOND';
const FEMTOSECOND = 'FEMTOSECOND';
const FORTNIGHT = 'FORTNIGHT';
const GAUSSIAN_YEAR = 'GAUSSIAN_YEAR';
const GIGASECOND = 'GIGASECOND';
const GREGORIAN_YEAR = 'GREGORIAN_YEAR';
const HOUR = 'HOUR';
const JULIAN_YEAR = 'JULIAN_YEAR';
const KILOSECOND = 'KILOSECOND';
const LEAPYEAR = 'LEAPYEAR';
const MEGASECOND = 'MEGASECOND';
const MICROSECOND = 'MICROSECOND';
const MILLENIUM = 'MILLENIUM';
const MILLISECOND = 'MILLISECOND';
const MINUTE = 'MINUTE';
const MONTH = 'MONTH';
const NANOSECOND = 'NANOSECOND';
const PETASECOND = 'PETASECOND';
const PICOSECOND = 'PICOSECOND';
const QUARTER = 'QUARTER';
const SECOND = 'SECOND';
const SHAKE = 'SHAKE';
const SIDEREAL_YEAR = 'SYNODIC_MONTH';
const TERASECOND = 'TERASECOND';
const TROPICAL_YEAR = 'TROPIC_YEAR';
const WEEK = 'WEEK';
const YEAR = 'YEAR';
/**
* Calculations for all time units
*
* @var array
*/
protected $_units = array(
'ANOMALISTIC_YEAR' => array('31558432', 'anomalistic year'),
'ATTOSECOND' => array('1.0e-18', 'as'),
'CENTURY' => array('3153600000', 'century'),
'DAY' => array('86400', 'day'),
'DECADE' => array('315360000', 'decade'),
'DRACONIC_YEAR' => array('29947974', 'draconic year'),
'EXASECOND' => array('1.0e+18', 'Es'),
'FEMTOSECOND' => array('1.0e-15', 'fs'),
'FORTNIGHT' => array('1209600', 'fortnight'),
'GAUSSIAN_YEAR' => array('31558196', 'gaussian year'),
'GIGASECOND' => array('1.0e+9', 'Gs'),
'GREAT_YEAR' => array(array('*' => '31536000', '*' => '25700'), 'great year'),
'GREGORIAN_YEAR' => array('31536000', 'year'),
'HOUR' => array('3600', 'h'),
'JULIAN_YEAR' => array('31557600', 'a'),
'KILOSECOND' => array('1000', 'ks'),
'LEAPYEAR' => array('31622400', 'year'),
'MEGASECOND' => array('1000000', 'Ms'),
'MICROSECOND' => array('0.000001', 'µs'),
'MILLENIUM' => array('31536000000', 'millenium'),
'MILLISECOND' => array('0.001', 'ms'),
'MINUTE' => array('60', 'min'),
'MONTH' => array('2628600', 'month'),
'NANOSECOND' => array('1.0e-9', 'ns'),
'PETASECOND' => array('1.0e+15', 'Ps'),
'PICOSECOND' => array('1.0e-12', 'ps'),
'QUARTER' => array('7884000', 'quarter'),
'SECOND' => array('1', 's'),
'SHAKE' => array('1.0e-9', 'shake'),
'SIDEREAL_YEAR' => array('31558149.7676', 'sidereal year'),
'TERASECOND' => array('1.0e+12', 'Ts'),
'TROPICAL_YEAR' => array('31556925', 'tropical year'),
'WEEK' => array('604800', 'week'),
'YEAR' => array('31536000', 'year'),
'STANDARD' => 'SECOND'
);
}