Skip to content

TimeZone rounds second-offset unlike DarwinFoundation. #5079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
YOCKOW opened this issue Aug 27, 2024 · 8 comments
Closed

TimeZone rounds second-offset unlike DarwinFoundation. #5079

YOCKOW opened this issue Aug 27, 2024 · 8 comments
Labels

Comments

@YOCKOW
Copy link
Member

YOCKOW commented Aug 27, 2024

The code below says all.

import Foundation

print(TimeZone(secondsFromGMT: 15)!.secondsFromGMT())
// Prints "15" with DarwinFoundation
// Prints  "0" with swift-corelibs-foundation

print(TimeZone(secondsFromGMT: 3690)!.secondsFromGMT())
// Prints "3690" with DarwinFoundation
// Prints "3720" with swift-corelibs-foundation

Environment
Swift version 6.0-dev (LLVM 57177aa1b91540b, Swift 8be62863326595c)
Target: x86_64-unknown-linux-gnu

@YOCKOW YOCKOW added the bug label Aug 27, 2024
@parkera
Copy link
Contributor

parkera commented Aug 27, 2024

On the macOS 15 Beta (which shares the same TimeZone implementation as Swift 6.0), I see these results:

  1> import Foundation
  2> print(TimeZone(secondsFromGMT: 15)!.secondsFromGMT())
15
  3> print(TimeZone(secondsFromGMT: 3690)!.secondsFromGMT())
3690

On the Ubuntu Swift 6 nightly snapshot from 8/22 I see these results:

  1> import Foundation
  2> print(TimeZone(secondsFromGMT: 15)!.secondsFromGMT())
15
  3> print(TimeZone(secondsFromGMT: 3690)!.secondsFromGMT())
3690

@parkera
Copy link
Contributor

parkera commented Aug 27, 2024

swift-6.0-DEVELOPMENT-SNAPSHOT-2024-08-22-a

@parkera
Copy link
Contributor

parkera commented Aug 27, 2024

So in other words, I can't reproduce the swift-corelibs-foundation result above. Is that from a previous release of Swift?

@YOCKOW
Copy link
Member Author

YOCKOW commented Aug 27, 2024

Is that from a previous release of Swift?

I’m sorry, but Swift which produced that result seems a little old. I confirmed that FoundationEssentials doesn’t have such a bug. I mean it is probably corelibs-foundation specific.

@parkera
Copy link
Contributor

parkera commented Aug 28, 2024

The test case above is using swift-corelibs-foundation (which re-exports FoundationEssentials' TimeZone type as of 6.0).

@YOCKOW
Copy link
Member Author

YOCKOW commented Aug 29, 2024

Hmm🤔
There may be some other factors affecting this issue.
I'm going to try more investigation.

@YOCKOW
Copy link
Member Author

YOCKOW commented Aug 29, 2024

Toolchain (Ubuntu 22.04) This issue
5.10.1 🪰 exists
swift-5.10-DEVELOPMENT-SNAPSHOT-2024-05-31-a 🪰 exists
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-19-a 🪰 exists
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-21-a ✅ no problem
swift-DEVELOPMENT-SNAPSHOT-2024-07-15-a 🪰 exists
swift-DEVELOPMENT-SNAPSHOT-2024-07-22-a ✅ no problem

I wonder what happened around 20th July.

@parkera
Copy link
Contributor

parkera commented Aug 29, 2024

That is when we merged the re-core into the 6.0 branch.

#5011

@parkera parkera closed this as completed Aug 29, 2024
@parkera parkera closed this as not planned Won't fix, can't repro, duplicate, stale Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants