aboutsummaryrefslogtreecommitdiffstats
path: root/lib/cosNotification/src/CosNotification_Common.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cosNotification/src/CosNotification_Common.erl')
-rw-r--r--lib/cosNotification/src/CosNotification_Common.erl68
1 files changed, 43 insertions, 25 deletions
diff --git a/lib/cosNotification/src/CosNotification_Common.erl b/lib/cosNotification/src/CosNotification_Common.erl
index af9b2d4368..530641b7a5 100644
--- a/lib/cosNotification/src/CosNotification_Common.erl
+++ b/lib/cosNotification/src/CosNotification_Common.erl
@@ -2,18 +2,19 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2015. All Rights Reserved.
%%
-%% The contents of this file are subject to the Erlang Public License,
-%% Version 1.1, (the "License"); you may not use this file except in
-%% compliance with the License. You should have received a copy of the
-%% Erlang Public License along with this software. If not, it can be
-%% retrieved online at http://www.erlang.org/.
-%%
-%% Software distributed under the License is distributed on an "AS IS"
-%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
-%% the License for the specific language governing rights and limitations
-%% under the License.
+%% Licensed under the Apache License, Version 2.0 (the "License");
+%% you may not use this file except in compliance with the License.
+%% You may obtain a copy of the License at
+%%
+%% http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS,
+%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+%% See the License for the specific language governing permissions and
+%% limitations under the License.
%%
%% %CopyrightEnd%
%%
@@ -39,8 +40,9 @@
%%--------------- EXPORTS ------------------------------------
%% External MISC
-export([get_option/3,
- create_name/2,
+ create_name/0,
create_name/1,
+ create_name/2,
create_id/0,
create_id/1,
is_debug_compiled/0,
@@ -110,17 +112,20 @@ get_option(Key, OptionList, DefaultList) ->
{error, "Invalid option"}
end
end.
-%%-----------------------------------------------------------%
-%% function : create_name/2
+
+%%------------------------------------------------------------
+%% function : create_name
%% Arguments:
%% Returns :
-%% Exception:
-%% Effect :
+%% Effect : Create a unique name to use when, for eaxmple, starting
+%% a new server.
%%------------------------------------------------------------
-create_name(Name,Type) ->
- {MSec, Sec, USec} = erlang:now(),
- lists:concat(['oe_',node(),'_',Type,'_',Name,'_',MSec, '_', Sec, '_', USec]).
-
+create_name() ->
+ Time = erlang:system_time(),
+ Unique = erlang:unique_integer([positive]),
+ lists:concat(['oe_',node(),'_',Time,'_',Unique]).
+
+
%%-----------------------------------------------------------%
%% function : create_name/1
%% Arguments:
@@ -129,8 +134,21 @@ create_name(Name,Type) ->
%% Effect :
%%------------------------------------------------------------
create_name(Type) ->
- {MSec, Sec, USec} = erlang:now(),
- lists:concat(['oe_',node(),'_',Type,'_',MSec, '_', Sec, '_', USec]).
+ Time = erlang:system_time(),
+ Unique = erlang:unique_integer([positive]),
+ lists:concat(['oe_',node(),'_',Type,'_',Time,'_',Unique]).
+
+%%-----------------------------------------------------------%
+%% function : create_name/2
+%% Arguments:
+%% Returns :
+%% Exception:
+%% Effect :
+%%------------------------------------------------------------
+create_name(Name,Type) ->
+ Time = erlang:system_time(),
+ Unique = erlang:unique_integer([positive]),
+ lists:concat(['oe_',node(),'_',Type,'_',Name,'_',Time,'_',Unique]).
%%------------------------------------------------------------
%% function : create_id/0
@@ -146,16 +164,16 @@ create_name(Type) ->
%%------------------------------------------------------------
create_id(-1) ->
1;
-create_id( 2147483647) ->
+create_id(2147483647) ->
-2147483648;
create_id(OldID) ->
OldID+1.
create_id() ->
- {_A,_B,C}=now(),
+ {_A,_B,C}=erlang:timestamp(),
C.
-%%-----------------------------------------------------------%
+%%------------------------------------------------------------
%% function : type_check
%% Arguments: Obj - objectrefernce to test.
%% Mod - Module which contains typeID/0.