Created
July 14, 2021 15:02
-
-
Save remi/9323dd147ce554440b6c538c84ae4443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Example1 do | |
@default_now DateTime.utc_now() | |
def foo(now \\ @default_now) do | |
IO.puts(now) | |
end | |
end | |
defmodule Example2 do | |
def foo(now \\ DateTime.utc_now()) do | |
IO.puts(now) | |
end | |
end | |
Example1.foo() | |
Example2.foo() | |
Process.sleep(10000) | |
Example1.foo() | |
Example2.foo() | |
Process.sleep(10000) | |
Example1.foo() | |
Example2.foo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ elixir test.exs | |
2021-07-14 15:01:48.062782Z | |
2021-07-14 15:01:48.088374Z | |
2021-07-14 15:01:48.062782Z | |
2021-07-14 15:01:58.088991Z | |
2021-07-14 15:01:48.062782Z | |
2021-07-14 15:02:08.089879Z |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment