Outside of Xcode, when I run the program (a "Command line tool") directly from 
the bash shell, it prints out in UTC "unixy" format:

2019-08-31 01:00:01 +0000

...but at the same time it gets logged in the Console log as:

Fri Aug 30 18:00:01 2019

Same result if I run it as a system daemon. So as you suggest it seems there 
could be some sort of environment sensitivity going on. If only I knew what env 
var to set in the shell... UTC really isn't what I'm looking for.

-Carl


> On Aug 30, 2019, at 5:20 PM, Uli Kusterer <witness.of.teacht...@gmx.net> 
> wrote:
> 
> Wildly guessing here, but could be that NSLog uses different implementations 
> depending on how it was launched. It could be using os_log() under the hood, 
> which doesn't necessarily format all parameters right away, but rather just 
> sends them to the logging system, which then formats it?
> 
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
> 
>> On 20. Aug 2019, at 21:50, Carl Hoefs via Cocoa-dev 
>> <cocoa-dev@lists.apple.com> wrote:
>> 
>> When printing out an NSDate using NSLog from within Xcode I get:
>> 
>> "Tue Aug 20 12:32:40 2019"
>> 
>> When the same program is run from within a shell (bash) window:
>> 
>> "2019-08-20 19:32:48 +0000"
>> 
>> Is the NSDate output format somehow determined by the environment? My system 
>> is set to Local Time Zone (America/Los_Angeles (PDT) offset -25200 
>> (Daylight)).
>> 
>> A code snippet that reproduces the issue follows. 
>> 
>> -Carl
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to