diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d6d8d8..0958d0a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add more test for unsubscribe/1 - Add questions section - Change default `@eb_tme_unit` to `:microsecond` +- Change all instances of `micro_seconds` and `microseconds` to `microsecond`, as per Erlang 19+ ## [1.3.X] diff --git a/README.md b/README.md index 73f9a97..532ea5d 100644 --- a/README.md +++ b/README.md @@ -288,7 +288,7 @@ It is recommended to set optional params in event_bus application config, this w config :event_bus, topics: [], # list of atoms ttl: 30_000_000, # integer - time_unit: :micro_seconds, # atom + time_unit: :microsecond, # atom id_generator: EventBus.Util.Base62 # module: must implement 'unique_id/0' function ``` diff --git a/config/test.exs b/config/test.exs index 8167bd7..ef6ee54 100644 --- a/config/test.exs +++ b/config/test.exs @@ -3,5 +3,5 @@ use Mix.Config config :event_bus, topics: [:metrics_received, :metrics_summed], ttl: 30_000_000, - time_unit: :micro_seconds, + time_unit: :microsecond, id_generator: EventBus.Util.String diff --git a/lib/event_bus/utils/base62.ex b/lib/event_bus/utils/base62.ex index 0dc1ff4..a00a64a 100644 --- a/lib/event_bus/utils/base62.ex +++ b/lib/event_bus/utils/base62.ex @@ -33,9 +33,9 @@ defmodule EventBus.Util.Base62 do |> String.pad_leading(size, "0") end - # Current time (microseconds) encoded in base62 + # Current time (microsecond) encoded in base62 defp now do - encode(System.os_time(:microseconds)) + encode(System.os_time(:microsecond)) end # Assigns a random node_id on first call diff --git a/test/event_bus/models/event_test.exs b/test/event_bus/models/event_test.exs index f3d3d91..7788ec7 100644 --- a/test/event_bus/models/event_test.exs +++ b/test/event_bus/models/event_test.exs @@ -11,7 +11,7 @@ defmodule EventBus.Model.EventTest do end test "duration" do - initialized_at = System.os_time(:micro_seconds) + initialized_at = System.os_time(:microsecond) # do sth in this frame Process.sleep(1) @@ -20,7 +20,7 @@ defmodule EventBus.Model.EventTest do topic: "user_created", data: %{id: 1, name: "me", email: "me@example.com"}, initialized_at: initialized_at, - occurred_at: System.os_time(:micro_seconds) + occurred_at: System.os_time(:microsecond) } assert Event.duration(event) > 0