Skip to content

Instantly share code, notes, and snippets.

@treyharris
Created June 13, 2019 21:59
Show Gist options
  • Select an option

  • Save treyharris/010c50a8072e69c4671cfdb62e8ea701 to your computer and use it in GitHub Desktop.

Select an option

Save treyharris/010c50a8072e69c4671cfdb62e8ea701 to your computer and use it in GitHub Desktop.

Illustration

HMSSeconds %.2f
0@ 00’ 01”1.00
0@ 0’ 2.3”2.00
0@ 0’ 2.5”2.00
0@ 1’ 59.5”119.00

Some more HMS calculations

Some multiplications by 2 show that the HMS form isn’t incapable of storing fractional seconds and operating on them; it just turns into integers whenever you use %f to display them.

HMSSecondsHMS x 2Seconds x 2HMS x 2
0@ 00’ 01”1.000@ 0’ 2.”2.002.00
0@ 0’ 2.3”2.000@ 0’ 4.6”4.004.00
0@ 0’ 2.5”2.000@ 0’ 5.”4.005.00
0@ 0’ 2.99”2.000@ 0’ 5.98”4.005.00
1@ 1’ 1”3660.002@ 2’ 2.”7320.007321.00
1@ 0’ 1.5”3601.002@ 0’ 3.”7202.007203.00
0@ 0’ 30”30.000@ 1’ 0”60.0060.00
0@ 0’ 30.5”30.000@ 1’ 1.”60.0061.00

From the “Formula syntax for Calc” Info page, I see no way other than %f to turn an HMS form into a plain number short of Elisp. For example:

HMS%.2ftTUe4p20
0@ 00’ 01”1.00000:00:0000:000@ 0’ 1”0@ 0’ 1”
0@ 0’ 2.3”2.00000:00:0000:000@ 0’ 2.3e0”0@ 0’ 2.3”
0@ 0’ 2.5”2.00000:00:0000:000@ 0’ 2.5e0”0@ 0’ 2.5”
0@ 0’ 2.99”2.00000:00:0000:000@ 0’ 2.99e0”0@ 0’ 2.99”
1@ 1’ 1”3660.00360001:00:0001:001@ 1’ 1”1@ 1’ 1”
1@ 0’ 1.5”3601.00360001:00:0001:001@ 0’ 1.5e0”1@ 0’ 1.5”
0@ 0’ 30”30.00000:00:0000:000@ 0’ 30”0@ 0’ 30”
0@ 0’ 30.5”30.00000:00:0000:000@ 0’ 30.5e0”0@ 0’ 30.5”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment