-
Notifications
You must be signed in to change notification settings - Fork 57
make FixedTimeZones be isbits by using ShortStrings #327
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,3 +1,7 @@ | ||||||
| # Ideally would always use ShortString15, but it's `hash` is broken on 32-bit systems. | ||||||
| # https://github.com/JuliaString/MurmurHash3.jl/issues/12 | ||||||
| const FixedTimeZoneName = Int === Int64 ? ShortString15 : String | ||||||
|
|
||||||
| const FIXED_TIME_ZONE_REGEX = r""" | ||||||
| ^(?| | ||||||
| Z | ||||||
|
|
@@ -30,7 +34,7 @@ const FIXED_TIME_ZONE_REGEX = r""" | |||||
| A `TimeZone` with a constant offset for all of time. | ||||||
| """ | ||||||
| struct FixedTimeZone <: TimeZone | ||||||
| name::String | ||||||
| name::FixedTimeZoneName | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Once ShortStrings.jl is fixed this type alias won't survive. May as well try to indicate what it truly is.
Suggested change
|
||||||
| offset::UTCOffset | ||||||
| end | ||||||
|
|
||||||
|
|
@@ -72,7 +76,7 @@ UTC+15:45:21 | |||||
| function FixedTimeZone(s::AbstractString) | ||||||
| s == "Z" && return UTC_ZERO | ||||||
|
|
||||||
| m = match(FIXED_TIME_ZONE_REGEX, s) | ||||||
| m = match(FIXED_TIME_ZONE_REGEX, String(s)) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you see an error before changing this? I'll note
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it errors before Iirc I looked in the docs for regex and it explicitly said it only worked on String. Which is a weird thing for Julia docs to say. |
||||||
| m === nothing && throw(ArgumentError("Unrecognized time zone: $s")) | ||||||
|
|
||||||
| coefficient = m[:sign] == "-" ? -1 : 1 | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really wish the 32-bit problem was properly fixed... if this is what we need to do then let's be as clear about it as we can.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is now fixed. So this PR needs updating