It works exactly the same for military time.
actual time 1840 alarm time 2210
1840 gives 18 * 60 + 40 = 1120 minutes since midnight 2210 gives 22 * 60 + 10 = 1330 minutes since midnight
1330 - 1120 = 210 minutes still to sleep