[NSTimeZone localTimeZone] and [NSTimeZone defaultTimeZone] incorrect in older simulators on High Sierra

Originator:rolfbjarne
Number:rdar://38174449 Date Originated:2018/03/06
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification: Reproducible:Always
 
Summary:

[NSTimeZone localTimeZone] and [NSTimeZone defaultTimeZone] returns incorrect time zone when running in an iOS 10.3 (or earlier) simulator on High Sierra.

Steps to Reproduce:

* Run attached test case on an iOS 10.3 simulator on High Sierra.

Expected Results:

localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

(the actual time zone will probably differ from mine)

Actual Results:

localTimeZone: Local Time Zone (GMT (GMT) offset 0)
defaultTimeZone: GMT (GMT) offset 0

Version/Build:
* Xcode Version 9.2 (9C40b)
* High Sierra 10.13.3 (broken)
* Sierra 10.12.6 (16G1212) (working)

Additional notes:
I tested the following configurations:

High Sierra
===========

sim 8.1:
localTimeZone: Local Time Zone (GMT (GMT) offset 0)
defaultTimeZone: GMT (GMT) offset 0

sim 10.3.1:
localTimeZone: Local Time Zone (GMT (GMT) offset 0)
defaultTimeZone: GMT (GMT) offset 0

sim 11.0.1:
localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

sim 11.1:
localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

sim 11.2:
localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

Sierra
======

sim 10.3.1
localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

sim 11.2:
localTimeZone: Local Time Zone (Europe/Madrid (GMT+1) offset 3600)
defaultTimeZone: Europe/Madrid (GMT+1) offset 3600

Comments

Test code: https://gist.github.com/rolfbjarne/8d0a8cdde8d7fa9354ad4d76ccb0a019

By rolfbjarne at March 6, 2018, 11:02 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!