diff --git a/src/hanoidb_nursery.erl b/src/hanoidb_nursery.erl index 11b1b6a..90e5a85 100644 --- a/src/hanoidb_nursery.erl +++ b/src/hanoidb_nursery.erl @@ -142,12 +142,12 @@ do_sync(File, Nursery) -> case application:get_env(hanoidb, sync_strategy) of {ok, sync} -> file:datasync(File), - now(); + os:timestamp(); {ok, {seconds, N}} -> - MicrosSinceLastSync = timer:now_diff(now(), Nursery#nursery.last_sync), - if (MicrosSinceLastSync / 1000000) >= N -> + MicrosSinceLastSync = timer:now_diff(os:timestamp(), Nursery#nursery.last_sync), + if (MicrosSinceLastSync div 1000000) >= N -> file:datasync(File), - now(); + os:timestamp(); true -> Nursery#nursery.last_sync end;