/[drupal]/contributions/modules/unitsapi/README.txt
ViewVC logotype

Contents of /contributions/modules/unitsapi/README.txt

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon Jan 5 21:02:00 2009 UTC (10 months, 3 weeks ago) by raspberryman
Branch: MAIN
CVS Tags: DRUPAL-6--1-0-ALPHA1, HEAD
File MIME type: text/plain
Initial commit of Units API module
1 /* $Id$ */
2
3 DESCRIPTION
4 -----------
5
6 The central API call, unitsapi_convert($value, $from, $to, $details = FALSE), uses the International System of Units (SI)
7 conversion factors to convert measurement units. For more, see: http://physics.nist.gov/Pubs/SP811/contents.html
8
9 This module is only an API and does not have an user interface.
10
11 EXAMPLES
12 ------
13
14 // Convert kilometer to feet
15 $result = unitsapi_convert(1.5, 'kilometer', 'foot');
16 // $result == 4921.259843
17
18 // Convert Fahrenheit to Kelvin
19 $result = unitsapi_convert(55, 'fahrenheit', 'kelvin');
20 // $result == 285.927778
21
22 // Convert US liquid ounces to Imperial pints with a detailed array of the conversion
23 $result = unitsapi_convert(50, 'us ounce', 'imperial pint', TRUE);
24 // $result == Array ([result] => 2.602107, [from] => US ounces, [to] => Imperial pints)
25
26 SUPPORTED UNITS
27 ------
28 All units are stored in units.xml.
29
30 Length:
31 millimeter
32 centimeter
33 decimeter
34 meter
35 kilometer
36 foot
37 inch
38 mile
39 yard
40
41 Volume:
42 cubic foot
43 cubic inch
44 cubic mile
45 cubic yard
46 cup (U.S.)
47 gallon (Imperial and U.S.)
48 liter
49 ounce (Imperial and U.S.)
50 pint (Imperial and U.S.)
51 quart (Imperial and U.S.)
52 tablespoon
53 teaspoon
54
55 Time:
56 day
57 hour
58 minute
59 year
60
61 Temperature:
62 Celsius
63 Fahrenheit (°F)
64 kelvin (K)
65
66 FUTURE PLANS
67 ------
68 1) Add additional measurement units (weights, etc)
69 2) Add additional automated tests
70
71 ISSUES
72 ------
73 Any issues are welcome to the Units API issue queue: http://drupal.org/project/issues/unitsapi).
74 Patches should be tested with the provided automated tests.
75
76 If testing conversions, use the assertion:
77 $this->assertUnitConversion($value, $from, $to, $expected, $group)
78
79 SPONSORED BY
80 ------
81 This module is sponsored by Raspberry Man LLC (http://www.raspberryman.com)

  ViewVC Help
Powered by ViewVC 1.1.2