Skip to content

Commit

Permalink
fixed bug, bumped deps
Browse files Browse the repository at this point in the history
  • Loading branch information
massivefermion committed Apr 1, 2024
1 parent b145096 commit 8f5d8bd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "birl"
version = "1.6.0"
version = "1.6.1"

description = "Date / Time handling for Gleam"
gleam = ">= 0.32.0"
Expand All @@ -9,7 +9,7 @@ repository = { type = "github", user = "massivefermion", repo = "birl" }
links = [{ title = "Gleam", href = "https://gleam.run" }]

[dependencies]
ranger = "~> 1.1"
ranger = "~> 1.2"
gleam_stdlib = "~> 0.36 or ~> 1.0"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
packages = [
{ name = "gleam_stdlib", version = "0.36.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "C0D14D807FEC6F8A08A7C9EF8DFDE6AE5C10E40E21325B2B29365965D82EB3D4" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "ranger", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "ranger", source = "hex", outer_checksum = "28E615AE7590ED922AF1510DDF606A2ECBBC2A9609AF36D412EDC925F06DFD20" },
{ name = "ranger", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "ranger", source = "hex", outer_checksum = "1566C272B1D141B3BBA38B25CB761EF56E312E79EC0E2DFD4D3C19FB0CC1F98C" },
]

[requirements]
gleam_stdlib = { version = "~> 0.36 or ~> 1.0" }
gleeunit = { version = "~> 1.0" }
ranger = { version = "~> 1.1" }
ranger = { version = "~> 1.2" }
13 changes: 8 additions & 5 deletions src/birl_ffi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ now() -> os:system_time(microsecond).

local_offset() ->
Timestamp = erlang:timestamp(),
{{LY, LN, LD}, {LH, LM, _}} = calendar:now_to_local_time(Timestamp),
{{UY, UN, UD}, {UH, UM, _}} = calendar:now_to_universal_time(Timestamp),
{{_, LMo, LD}, {LH, LM, _}} = calendar:now_to_local_time(Timestamp),
{{_, UMo, UD}, {UH, UM, _}} = calendar:now_to_universal_time(Timestamp),
if
LD == UD -> (LH - UH) * 60 + LM - UM;
LD > UD orelse LN > UN orelse LY > UY -> (23 - UH) * 60 + (60 - UM) + LH * 60 + LM;
LD < UD -> -((23 - LH) * 60 + (60 - LM) + UH * 60 + UM)
LD == UD ->
(LH - UH) * 60 + LM - UM;
LD > UD andalso LMo == UMo ->
(23 - UH) * 60 + (60 - UM) + LH * 60 + LM;
true ->
-((23 - LH) * 60 + (60 - LM) + UH * 60 + UM)
end.

local_timezone() ->
Expand Down

0 comments on commit 8f5d8bd

Please sign in to comment.