Sunday, November 01, 2009

New Mac Blogging Software

I'm trying out some new blogging software for my mac called blogo. I've been using a windows vm with LiveWriter installed - which is a spectacular piece of software for my blog postings up until now. I tried blog about a year ago and got very frustrated with it and happily uninstalled it - I hear it's a lot better now - we'll see.


My last post I was lamenting about the use of of timestamps in the iPhone SDK specifically CoreLocation, and as usual it takes me proving my ignorance before I can figure something out. So, here is what was going on...

If you remember back in your first C programming class - you learned about the function called printf. I specifically remember my instructor explaining the function and that the %d symbol meant to format an integer value and %f meant to format a float value. This information was lost to the deep recesses of my memories. This is important as I was using the %d to for logging -basically to output the age of the calculation - trying to understand what was going on and getting crazy - seemingly random values for the age.

Anyway this is the correct way to get the age from a CLLocation object:

float age = fabs([[newLocation timestamp] timeIntervalSinceNow]);

Armed with the value of age you can proceed with confidence that you are calculating the age of your location correctly.

-Aaron


No comments: