I am puzzled by the differences underlined in red below:
How come this very same NSDate object is displayed in BST in the debug pane, but in GMT in the LLDB terminal when asked to '"Print description of "date"' ?
This is with Xcode 4.6.1
I am puzzled by the differences underlined in red below:
How come this very same NSDate object is displayed in BST in the debug pane, but in GMT in the LLDB terminal when asked to '"Print description of "date"' ?
This is with Xcode 4.6.1
Brent's reply is fine - but I wanted to address one detail specifically. lldb has built in type formatters for many common types including
NSDate
. If you didp date
in the debugger console, you would get the same output as you see in the Locals window. When you right-click/control-clicked on the variable and did 'Print description', it is equivalent to writingpo date
in the console -- as Brent says, it calls the-description
method.This isn't a console vrs. Locals window difference, or an Xcode vrs. lldb difference. One access method is using lldb's built in data formatters and one is calling
-description
.An
NSDate
represents a specific moment in time, without any consideration of what human beings call that moment. If you look atNSDate
, you'll notice that there aren't evenhour
,minute
, orsecond
properties, let alone atimeZone
property. The time zone is a feature of theNSCalendar
used to interpret thatNSDate
for display. (You may be more familiar withNSDateFormatter
; it internally uses anNSCalendar
to interpret the date.)In this case, Xcode happens to configure the calendar for the variables panel a little differently from how LLDB configures the one for the debug console. I'd have to guess that the debug console is calling
-description
, which always uses UTC, while the variables panel is using a date formatter that respects the current time zone. (Your Mac is configured to use BST, right? If not, that's an odd choice...)