Просмотр исходного кода

rename time_compat module to avoid conflicts. Use new compat module.

Andreas Stenius 9 лет назад
Родитель
Сommit
b58b6f4391
2 измененных файлов с 7 добавлено и 3 удалено
  1. 5 2
      src/erlydtl_filters.erl
  2. 2 1
      src/erlydtl_time_compat.erl

+ 5 - 2
src/erlydtl_filters.erl

@@ -48,7 +48,8 @@
         -export([cast_to_float/1,cast_to_integer/1,stringformat_io/7,round/2,unjoin/2,addDefaultURI/1]).
 -endif.
  
- 
+-import(erlydtl_time_compat, [phash2/1, monotonic_time/0, unique_integer/0]).
+
 -export([add/2,
         addslashes/1,
         capfirst/1,
@@ -539,7 +540,9 @@ random(_) ->
     "".
 
 random_num(Value) ->
-    _ = random:seed(now()),
+    random:seed(phash2([node()]),
+                monotonic_time(),
+                unique_integer()),
     random:uniform(Value).
 
 %% random tags to be used when using erlydtl in testing

+ 2 - 1
src/time_compat.erl → src/erlydtl_time_compat.erl

@@ -31,7 +31,8 @@
 %% instead of calling the BIFs directly.
 %%
 
--module(time_compat).
+%% use own name to avoid conflicts..
+-module(erlydtl_time_compat).
 
 %% We don't want warnings about the use of erlang:now/0 in
 %% this module.