Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:20
jc
jc-1.2.1-timestamp.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File jc-1.2.1-timestamp.patch of Package jc
diff -Ndurp jc-1.2.1/src/jc_cluster.erl jc-1.2.1-timestamp/src/jc_cluster.erl --- jc-1.2.1/src/jc_cluster.erl 2016-09-07 15:51:56.000000000 +0300 +++ jc-1.2.1-timestamp/src/jc_cluster.erl 2018-11-29 01:11:33.571498861 +0200 @@ -39,7 +39,6 @@ %%% Created : 17 Mar 2015 by Jim Rosenblum <jrosenblum@jims-mbp.jhs.local> %%% ---------------------------------------------------------------------------- -module(jc_cluster). --compile(nowarn_deprecated_function). % accomidate now() for v < 18 %% API -export([init/0, @@ -215,7 +214,7 @@ dynamic_db_init([]) -> ]), mnesia:dirty_write(#stats{key = 'jc_store_up_time', - value = calendar:now_to_datetime(timestamp())}), + value = calendar:universal_time()}), mnesia:dirty_write(#stats{key = 'cluster_id', value = node()}), @@ -246,13 +245,3 @@ add_extra_nodes([Node|Nds]) -> _ -> add_extra_nodes(Nds) end. - - -% Try to used erlang 18+ timestamp(), support older versions if necessary. -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() -end. diff -Ndurp jc-1.2.1/src/jc.erl jc-1.2.1-timestamp/src/jc.erl --- jc-1.2.1/src/jc.erl 2016-09-07 15:51:56.000000000 +0300 +++ jc-1.2.1-timestamp/src/jc.erl 2018-11-29 01:16:01.313144101 +0200 @@ -17,7 +17,6 @@ %%% ---------------------------------------------------------------------------- -module(jc). --compile(nowarn_deprecated_function). % accomidate now() for v < 18 % Put Functions -export([put/3, put/4, @@ -114,13 +113,8 @@ cache_size()-> up() -> {uptime, Start} = jc_store:stats(up), - StartSecs = calendar:datetime_to_gregorian_seconds(Start), - - Now = calendar:now_to_datetime(timestamp()), - NowSecs = calendar:datetime_to_gregorian_seconds(Now), - - Uptime = calendar:seconds_to_daystime(NowSecs-StartSecs), - + Now = calendar:universal_time(), + Uptime = calendar:time_difference(Start, Now), {uptime, [{up_at, rfc1123_date(Start)}, {now, rfc1123_date(Now)}, {up_time, Uptime}]}. @@ -544,19 +538,6 @@ to_path_elt(Element) -> Element end. - -% Try to used erlang 18+ timestamp(), support older versions if necessary. -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() -end. - - - - % Lifted from Ericson's httpd_util module to convert a datetime to a string rfc1123_date(LocalTime) -> {{YYYY,MM,DD},{Hour,Min,Sec}} = diff -Ndurp jc-1.2.1/src/jc_store.erl jc-1.2.1-timestamp/src/jc_store.erl --- jc-1.2.1/src/jc_store.erl 2016-09-07 15:51:56.000000000 +0300 +++ jc-1.2.1-timestamp/src/jc_store.erl 2018-11-29 01:00:54.946647605 +0200 @@ -31,7 +31,6 @@ %%% Created : 16 Oct 2011 by Jim Rosenblum %%% ---------------------------------------------------------------------------- -module(jc_store). --compile(nowarn_deprecated_function). % accomidate now() for v < 18 %% Jc_store public API -export([clear/1, @@ -566,10 +565,8 @@ indexes(Map) -> %% -- UNIX-style epoch. %% -now_to_uepoch() -> - {A,B,C} = timestamp(), - ((A * 1000000 + B) * 1000000) + C. - +now_to_uepoch() -> erlang:system_time(micro_seconds). +-compile({inline, [now_to_uepoch/0]}). % walk the path of a decoded JSON object using the ej library. ej_get(Paths, Obj) -> @@ -610,15 +607,3 @@ to_path_elt(Element) -> _:_ -> Element end. - - - -% Try to used erlang 18+ timestamp(), support older versions if necessary. -timestamp() -> - try - erlang:timestamp() - catch - error:undef -> - erlang:now() -end. -
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor