Skip to content

Commit 2b2324f

Browse files
Wynandomus
andauthored
Make FixedTimeZone isbits (#354)
Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
1 parent 6eb9788 commit 2b2324f

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-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.6.0"
66
[deps]
77
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
88
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
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"
@@ -16,6 +17,7 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
1617

1718
[compat]
1819
Downloads = "1"
20+
InlineStrings = "1.0"
1921
LazyArtifacts = "1.3"
2022
Mocking = "0.7"
2123
RecipesBase = "0.7, 0.8, 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: 2 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,4 @@ end
9595

9696
name(tz::FixedTimeZone) = tz.name
9797
rename(tz::FixedTimeZone, name::AbstractString) = FixedTimeZone(name, tz.offset)
98+

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)