Skip to content

Instantly share code, notes, and snippets.

@CennoxX
Created March 3, 2018 00:58
Show Gist options
  • Save CennoxX/95b549d7a9f2f03e35be84e5b600f6ef to your computer and use it in GitHub Desktop.
Save CennoxX/95b549d7a9f2f03e35be84e5b600f6ef to your computer and use it in GitHub Desktop.
m(x) ... minutes of the time x
h(x) ... hours of the time x
add time
a+b=c
if (m(c)>=60) || (h(a)+h(b)>h(c))
c=c+40
subtract time
a-b=c
if (m(a)<m(b)) //includes if m(c)>=60
c=c-40
example
5:30+2:40h
calculate 530+240=770
m(770)=70; 70>=60
770+40=810
calculated time 8:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment