0

I want to display current time in my iPhone app using my own custom graphics. What's the most efficient way to get the hours, minutes and seconds info? I thought about using NSDateFormatter to get each part but this seems to be too CPU intensive.

Jay
  • 18,817
  • 36
  • 115
  • 173
Boon
  • 39,286
  • 55
  • 198
  • 305
  • Care to explain how you came to that conclusion with NSDateFormatter? I could imagine that changing the format string several times a second could seriously slow it down, but what if you used one formatter per component? – Mike Abdullah Sep 25 '09 at 09:04

1 Answers1

1

You'll want to use NSDateComponents. This answer on SO provides an example.

Community
  • 1
  • 1
progrmr
  • 73,806
  • 16
  • 109
  • 147
  • Also take a look at this answer on SO. It's a little more specific to your question http://stackoverflow.com/questions/743140/how-do-i-get-the-current-hour-using-cocoa – probablyCorey Sep 24 '09 at 23:06