AppleTV Timezone Values Mismatch

App includes a functionality based on each Timezone. As i have fetched some of the Timezone values got some mismatched values compared to actual.

e.g: America/Denver values is -6 but got -5

Need support regarding fixing this issue.

Answered by DTS Engineer in 848231022

Time zone are hard, and it’s easy to write code that looks correct but isn’t. Can you post more details about how your fetching the timezone and how you’re evaluating it’s correctness.

For example, this code:

import Foundation

func main() {
    let denverTimeZone = TimeZone(identifier: "America/Denver")!
    print(denverTimeZone.secondsFromGMT(for: .now))
}

main()

running on my Mac (macOS 15.5) [1] prints:

-21600

which is correct, right?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] It’s possible that macOS and tvOS behave differently here, but that’s very unlikely. All of this code is shared between all our platforms. I’m happy to try it on tvOS, but to do that I’ll need to know what version of tvOS you’re testing on.

Are you allowing for daylight saving time? It is currently -6 hours relative to GMT.

and then I realize I can't read.

Time zone are hard, and it’s easy to write code that looks correct but isn’t. Can you post more details about how your fetching the timezone and how you’re evaluating it’s correctness.

For example, this code:

import Foundation

func main() {
    let denverTimeZone = TimeZone(identifier: "America/Denver")!
    print(denverTimeZone.secondsFromGMT(for: .now))
}

main()

running on my Mac (macOS 15.5) [1] prints:

-21600

which is correct, right?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] It’s possible that macOS and tvOS behave differently here, but that’s very unlikely. All of this code is shared between all our platforms. I’m happy to try it on tvOS, but to do that I’ll need to know what version of tvOS you’re testing on.

AppleTV Timezone Values Mismatch
 
 
Q