From 6be7ea2aefb91cb8011004a196b379cd7cd0e3b5 Mon Sep 17 00:00:00 2001 From: Lukasz Pik Date: Thu, 19 Oct 2017 16:38:41 +0200 Subject: [PATCH] [ACR-661] Added measure units guide PS2: Reviewed PS3: Code snippet formatting fixed and AR link added Change-Id: I696a53dc75601c1aef12f3c7e24bcf6916bea5ac Signed-off-by: Lukasz Pik --- .../html/native/internationalization/i18n_n.htm | 586 +++++++++++++++++++++ 1 file changed, 586 insertions(+) diff --git a/org.tizen.guides/html/native/internationalization/i18n_n.htm b/org.tizen.guides/html/native/internationalization/i18n_n.htm index ae02bac..dd3f45c 100644 --- a/org.tizen.guides/html/native/internationalization/i18n_n.htm +++ b/org.tizen.guides/html/native/internationalization/i18n_n.htm @@ -599,6 +599,518 @@ The measure objects can be formatted using the MeasureFormat API (in mobile and wearable applications). +

The MeasureUnit API (in mobile and wearable applications) allows you to create measure unit objects and combine them with numerical values to create measure objects.

+

The following table lists the supported measures and units.

+ +

Table: Measures and units

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
MeasureUnitSymbol
Accelerationg-forceg-force
meter per second squaredm/s2
Anglearc minutearcmin
arc secondarcsec
degree°
radianrad
Areaacreac
hectareha
square centimetercm2
square meterm2
square kilometerkm2
square footft2
square inchin2
square milemi2
square yardyd2
Consumptionliter per kilometerl/km
mile per gallonmpg
Digitalbitbit
byteB
kilobitkbit
kilobytekB
megabitMbit
megabyteMB
gigabitGbit
gigbabyteGB
terabitTbit
terabyteTB
Durationnanosecondns
microsecondµs
millisecondms
seconds
minutemin
hourh
dayd
weekweek
monthmonth
yearyear
ElectricampereA
milliamperemA
ohm
voltV
Energycaloriecal
kilocaloriekcal
food calorieCal
jouleJ
kilojoulekJ
kilowatt-hourkWh
FrequencyhertzHz
kilohertzkHz
megahertzMHz
Lengthpicometerpm
nanometernm
micrometerµm
millimetermm
centimetercm
decimeterdm
meterm
kilometerkm
inchin
footft
fathomfathom
yardyd
furlongfur
milemi
nautical milenmi
astronomical unitau
light yearly
parsecpc
Illuminanceluxlx
Masscaratct
microgramµg
milligrammg
gramg
kilogramkg
metric tont
ounceoz
troy ounceoz t
poundlb
stonest
tonton
Powerhorsepowerhp
milliwattmW
wattW
kilowattkW
megawattMW
gigawattGW
PressurehectopascalhPa
inch of mercuryinHg
millibarmbar
millimeter of mercurymmHg
pound per square inchpsi
ProportionkaratK or kt
Speedmeter per secondm/s
kilometer per hourkm/h
mile per hourmph
Temperaturedegree Celcius°C
degree Fahrenheit°F
kelvinK
Volumeacre-footac-ft
bushelbsh or bu
milliliterml
centilitercl
deciliterdl
literl
hectoliterhl
megaliterMl
cubic centimetercm3
cubic footft3
cubic inchin3
cubic kilometerkm3
cubic meterm3
cubic milemi3
cubic yardyd3
cupcup
fluid ouncefl oz
gallongal
pintpt
quartqt
teaspoontsp
tablespoontbsp
+

Time Scale Conversion with Utmscale

The Utmscale API (in mobile and wearable applications) allows you to convert between time scales.

There are various conventions for binary datetime, depending on the platform and protocol. Some of these have severe drawbacks. For example, 32-bit Unix time (seconds since Jan 1, 1970) cannot support datetimes beyond the beginning of the year 2038. Arithmetic manipulations can also cause serious problems. For example, when calculating the average of 2 datetimes, if you calculate them with average_time = (time1 + time2)/2, there can be overflow even with dates around the present. Additionally, there is the issue of converting between different systems.

@@ -2197,6 +2709,80 @@ i18n_measure_destroy(measure); +

Managing Measurement Units

+

You can use the MeasureUnit API (in mobile and wearable applications) to create measure unit objects, which can be passed to the Measure or MeasureFormat (in mobile and wearable applications) APIs.

+
    +
  1. To create a liter unit object: +
    +i18n_measure_unit_h unit;
    +i18n_measure_unit_create_liter(&unit);
    +
    +

    You can create measure unit objects for various units, using the corresponding i18n_measure_unit_create_xxx() functions.

    +
  2. +
  3. To clone a measure unit object: +
    +i18n_measure_unit_h clone;
    +i18n_measure_unit_clone(unit, &clone);
    +
  4. +
  5. To retrieve information about a measure unit object: +
      +
    • To retrieve the unit type: +
      +char *type;
      +i18n_measure_unit_get_type(unit, &type);
      +
    • +
    • To retrieve the unit subtype: +
      +char *subtype;
      +i18n_measure_unit_get_subtype(unit, &subtype);
      +
    • +
  6. +
  7. To retrieve all available units: +
    +int32_t max = 20;
    +i18n_measure_unit_h array[20];
    +int32_t available;
    +
    +i18n_measure_unit_get_available(max, &array, &available); 
    +
  8. +
  9. To retrieve the available units for a specific measure: +
    +int32_t max = 20;
    +const char *type = "volume"; /* Specify the measure */
    +i18n_measure_unit_h array[20];
    +int32_t available;
    +
    +i18n_measure_unit_get_available_with_type(max, type, &array, &available);
    +
  10. +
  11. To invoke a callback for each available measure unit: +
      +
    1. Define the callback function: +
      +void
      +measure_unit_available_types_cb(const char *type_id, void *user_data)
      +{
      +    char *text = (char *)user_data;
      +    fprintf(stderr, "type_id : %s\n", text);
      +
      +    return false;
      +}
      +
      +
    2. +
    3. Invoke the foreach function, using the callback and the data to pass to it as parameters. +

      The data passed in the second parameter is used as the user_data parameter in the callback.

      +
      +char *data = "data";
      +i18n_measure_unit_foreach_available_type(measure_unit_available_types_cb, data);
      +
      +
    4. +
    +
  12. +
  13. When no longer needed, destroy the measure unit object: +
    +i18n_measure_unit_destroy(unit);
    +
  14. +
+

Converting Time Scales

Since Tizen 3.0, you can use the Utmscale API (in mobile and wearable applications) to convert binary datetimes between various platform-dependent time scales.

To convert a datetime value:

-- 2.7.4