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.

2
  • 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
    Commented Mar 6, 2018 at 5:22
  • Depending on what you mean by your question, see the Elisp manual, node Time Parsing or other time-related nodes under node System Interface.
    – Drew
    Commented Mar 6, 2018 at 5:24

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.