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