nickva commented on a change in pull request #883: Fix erlang time module 
compatibility
URL: https://github.com/apache/couchdb/pull/883#discussion_r143891138
 
 

 ##########
 File path: src/couch/src/couch_uuids.erl
 ##########
 @@ -39,16 +39,22 @@ new() ->
 random() ->
     list_to_binary(couch_util:to_hex(crypto:strong_rand_bytes(16))).
 
-utc_random() ->
-    utc_suffix(couch_util:to_hex(crypto:strong_rand_bytes(9))).
-
-utc_suffix(Suffix) ->
-    Now = {_, _, Micro} = erlang:now(), % uniqueness is used.
-    Nowish = calendar:now_to_universal_time(Now),
-    Nowsecs = calendar:datetime_to_gregorian_seconds(Nowish),
-    Then = calendar:datetime_to_gregorian_seconds({{1970, 1, 1}, {0, 0, 0}}),
-    Prefix = io_lib:format("~14.16.0b", [(Nowsecs - Then) * 1000000 + Micro]),
-    list_to_binary(Prefix ++ Suffix).
+utc_random(ClockSeq) ->
 
 Review comment:
   Good idea. Will move utc_suffix as well since it is not exported.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to