Created
June 1, 2013 20:55
-
-
Save odrobnik/5691712 to your computer and use it in GitHub Desktop.
Quick and very dirty time math
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get a time stamp from a pebble time struct | |
long timestampFromTime(PblTm time) | |
{ | |
return (((time.tm_mday * 24) + time.tm_hour) * 60 + time.tm_min) * 60 + time.tm_sec; | |
} | |
long timeintervalBetweenTimes(PblTm time1, PblTm time0) | |
{ | |
long timestamp1 = timestampFromTime(time1); | |
long timestamp0 = timestampFromTime(time0); | |
return timestamp0 - timestamp1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hm, if all you use for calculation is days and less, you'd have to make sure you don't have different months or worse.
I know, this is for WWDC countdown and dirty, but oh well :D