Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix time-fudging code to be 100% deterministic

  • Loading branch information...
commit 7508d884c4272481ccb2685257ae8f84952d2b30 1 parent dec7f03
@slfritchie slfritchie authored
Showing with 4 additions and 5 deletions.
  1. +2 −0  rebar.config
  2. +2 −5 src/bitcask_time.erl
View
2  rebar.config
@@ -66,6 +66,8 @@
%% , {bitcask_nifs, file_write, 2}
%% , {bitcask_nifs, file_seekbof, 1}
%%
+ %% , {bitcask_time, tstamp, 0}
+ %%
%% , {file, '_', '_'}
%% , {filelib, '_', '_'}
%% , {os, '_', '_'} ]},
View
7 src/bitcask_time.erl
@@ -28,10 +28,6 @@
%% Return number of seconds since 1970
tstamp() ->
- {Mega, Sec, _Micro} = os:timestamp(),
- (Mega * 1000000) + Sec + fudge().
-
-fudge() ->
test__get(?KEY).
test__set_fudge(Amount) ->
@@ -56,7 +52,8 @@ test__get(Key) ->
end,
test__get(Key);
no_testing ->
- 0;
+ {Mega, Sec, _Micro} = os:timestamp(),
+ (Mega * 1000000) + Sec;
yes_testing ->
{ok, Fudge} = application:get_env(bitcask, Key),
Fudge

0 comments on commit 7508d88

Please sign in to comment.
Something went wrong with that request. Please try again.