Skip to content

Commit bd49e9b

Browse files
committed
Switch FixedTimeZone to InlineStrings name
1 parent ae1e583 commit bd49e9b

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ version = "1.5.7"
66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
88
Future = "9fa8497b-333b-5362-9e8d-4d0656e87820"
9+
InlineStrings = "842dd82b-1e85-43dc-bf29-5d0ee9dffc48"
910
LazyArtifacts = "4af54fe1-eca0-43a8-85a7-787d91b784e3"
1011
Mocking = "78c3b35d-d492-501b-9361-3d52fe80e533"
1112
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
@@ -15,6 +16,7 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
1516
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
1617

1718
[compat]
19+
InlineStrings = "1"
1820
Mocking = "0.7"
1921
RecipesBase = "0.7, 0.8, 1"
2022
julia = "1"

src/TimeZones.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ using Printf
55
using Serialization
66
using RecipesBase: RecipesBase, @recipe
77
using Unicode
8+
using InlineStrings: InlineString15
89

910
import Dates: TimeZone, UTC
1011

src/types/fixedtimezone.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const FIXED_TIME_ZONE_REGEX = r"""
3030
A `TimeZone` with a constant offset for all of time.
3131
"""
3232
struct FixedTimeZone <: TimeZone
33-
name::String
33+
name::InlineString15
3434
offset::UTCOffset
3535
end
3636

@@ -95,3 +95,8 @@ end
9595

9696
name(tz::FixedTimeZone) = tz.name
9797
rename(tz::FixedTimeZone, name::AbstractString) = FixedTimeZone(name, tz.offset)
98+
99+
function Base.isequal(a::FixedTimeZone, b::FixedTimeZone)
100+
return isequal(a.name, b.name) && isequal(a.offset, b.offset)
101+
end
102+

test/types/fixedtimezone.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
@testset "FixedTimeZone" begin
2+
@test isbitstype(FixedTimeZone)
3+
24
@test FixedTimeZone("0123") == FixedTimeZone("UTC+01:23", 4980)
35
@test FixedTimeZone("+0123") == FixedTimeZone("UTC+01:23", 4980)
46
@test FixedTimeZone("-0123") == FixedTimeZone("UTC-01:23", -4980)

0 commit comments

Comments
 (0)