Next: , Previous: Strings, Up: Data Types

4.8 HMS Forms

HMS stands for Hours-Minutes-Seconds; when used as an angular argument, the interpretation is Degrees-Minutes-Seconds. All functions that operate on angles accept HMS forms. These are interpreted as degrees regardless of the current angular mode. It is also possible to use HMS as the angular mode so that calculated angles are expressed in degrees, minutes, and seconds.

The default format for HMS values is ‘hours@ mins' secs"’. During entry, the letters ‘h’ (for “hours”) or ‘o’ (approximating the “degrees” symbol) are accepted as well as ‘@’, ‘m’ is accepted in place of ‘'’, and ‘s’ is accepted in place of ‘"’. The hours value is an integer (or integer-valued float). The mins value is an integer or integer-valued float between 0 and 59. The secs value is a real number between 0 (inclusive) and 60 (exclusive). A positive HMS form is interpreted as hours + mins/60 + secs/3600. A negative HMS form is interpreted as - hours - mins/60 - secs/3600. Display format for HMS forms is quite flexible. See HMS Formats.

HMS forms can be added and subtracted. When they are added to numbers, the numbers are interpreted according to the current angular mode. HMS forms can also be multiplied and divided by real numbers. Dividing two HMS forms produces a real-valued ratio of the two angles.

Just for kicks, M-x calc-time pushes the current time of day on the stack as an HMS form.