4

Is there a built-in way to convert/toggle between GNU Emacs Calc's HMS forms and seconds? I'd also like to easily be able to add numbers as seconds and/or minutes to an existing HMS form.

user117529
  • 151
  • 4
  • Please specify what you mean by "*HMS form*". Do you mean a list of numbers? A formatted time string? The question is unclear so far, and so risks being closed. – Drew Mar 06 '18 at 05:22
  • Depending on what you mean by your question, see the Elisp manual, node [Time Parsing](https://www.gnu.org/software/emacs/manual/html_node/elisp/Time-Parsing.html) or other time-related nodes under node [System Interface](https://www.gnu.org/software/emacs/manual/html_node/elisp/System-Interface.html). – Drew Mar 06 '18 at 05:24

1 Answers1

5

One way of going from an HMS form to the number of seconds is hinted by a line from the HMS forms page:

Dividing two HMS forms produces a real-valued ratio of the two angles.

So if an HMS form is on the stack

5@ 30' 0"

entering one second to the stack

1"

and dividing by it

/

gives the number of seconds:

19800.

Not exactly a convert but it's only three keystrokes.

G. D. McBain
  • 51
  • 1
  • 3